1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-23 00:18:47 +00:00

Add ToInt16 and ToInt64 in BooleanTests

This commit is contained in:
Oliver Booth 2020-04-18 23:39:04 +01:00
parent 66d68b01bf
commit bf779bafec
No known key found for this signature in database
GPG Key ID: 0D7F2EF1C8D2B9C0

View File

@ -8,6 +8,38 @@ namespace X10D.Tests
[TestClass] [TestClass]
public class BooleanTests public class BooleanTests
{ {
/// <summary>
/// Tests for <see cref="BooleanExtensions.ToByte"/>.
/// </summary>
[TestMethod]
public void ToByte()
{
const bool a = true;
const bool b = false;
const byte c = 1;
const byte d = 0;
Assert.IsTrue(a);
Assert.IsFalse(b);
Assert.AreEqual(c, a.ToByte());
Assert.AreEqual(d, b.ToByte());
}
/// <summary>
/// Tests for <see cref="BooleanExtensions.ToInt16"/>.
/// </summary>
[TestMethod]
public void ToInt16()
{
const bool a = true;
const bool b = false;
Assert.IsTrue(a);
Assert.IsFalse(b);
Assert.AreEqual(1, a.ToInt16());
Assert.AreEqual(0, b.ToInt16());
}
/// <summary> /// <summary>
/// Tests for <see cref="BooleanExtensions.ToInt32"/>. /// Tests for <see cref="BooleanExtensions.ToInt32"/>.
/// </summary> /// </summary>
@ -24,20 +56,18 @@ namespace X10D.Tests
} }
/// <summary> /// <summary>
/// Tests for <see cref="BooleanExtensions.ToByte"/>. /// Tests for <see cref="BooleanExtensions.ToInt64"/>.
/// </summary> /// </summary>
[TestMethod] [TestMethod]
public void ToByte() public void ToInt64()
{ {
const bool a = true; const bool a = true;
const bool b = false; const bool b = false;
const byte c = 1;
const byte d = 0;
Assert.IsTrue(a); Assert.IsTrue(a);
Assert.IsFalse(b); Assert.IsFalse(b);
Assert.AreEqual(c, a.ToByte()); Assert.AreEqual(1L, a.ToInt64());
Assert.AreEqual(d, b.ToByte()); Assert.AreEqual(0L, b.ToInt64());
} }
/// <summary> /// <summary>