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
1 changed files with 36 additions and 6 deletions

View File

@ -8,6 +8,38 @@ namespace X10D.Tests
[TestClass]
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>
/// Tests for <see cref="BooleanExtensions.ToInt32"/>.
/// </summary>
@ -24,20 +56,18 @@ namespace X10D.Tests
}
/// <summary>
/// Tests for <see cref="BooleanExtensions.ToByte"/>.
/// Tests for <see cref="BooleanExtensions.ToInt64"/>.
/// </summary>
[TestMethod]
public void ToByte()
public void ToInt64()
{
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());
Assert.AreEqual(1L, a.ToInt64());
Assert.AreEqual(0L, b.ToInt64());
}
/// <summary>