1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-14 04:15:41 +00:00
X10D/X10D.Tests/src/Time/DoubleTests.cs

54 lines
1.7 KiB
C#
Raw Normal View History

using Microsoft.VisualStudio.TestTools.UnitTesting;
using X10D.Time;
namespace X10D.Tests.Time;
[TestClass]
public class DoubleTests
{
private Half _negativeOne;
private Half _one;
private Half _zero;
[TestInitialize]
public void Initialize()
{
_negativeOne = (Half)(-1);
_one = (Half)1;
_zero = (Half)0;
}
[TestMethod]
public void TicksMillisecondsSecondsMinutesDaysHoursWeeks_ShouldBeZero_GivenZero()
{
Assert.AreEqual(TimeSpan.Zero, _zero.Milliseconds());
Assert.AreEqual(TimeSpan.Zero, _zero.Seconds());
Assert.AreEqual(TimeSpan.Zero, _zero.Minutes());
Assert.AreEqual(TimeSpan.Zero, _zero.Days());
Assert.AreEqual(TimeSpan.Zero, _zero.Hours());
Assert.AreEqual(TimeSpan.Zero, _zero.Weeks());
}
[TestMethod]
public void TicksMillisecondsSecondsMinutesDaysHoursWeeks_ShouldBePositive_GivenOne()
{
Assert.IsTrue(_one.Milliseconds() > TimeSpan.Zero);
Assert.IsTrue(_one.Seconds() > TimeSpan.Zero);
Assert.IsTrue(_one.Minutes() > TimeSpan.Zero);
Assert.IsTrue(_one.Days() > TimeSpan.Zero);
Assert.IsTrue(_one.Hours() > TimeSpan.Zero);
Assert.IsTrue(_one.Weeks() > TimeSpan.Zero);
}
[TestMethod]
public void TicksMillisecondsSecondsMinutesDaysHoursWeeks_ShouldBeNegative_GivenMinusOne()
{
Assert.IsTrue((_negativeOne).Milliseconds() < TimeSpan.Zero);
Assert.IsTrue((_negativeOne).Seconds() < TimeSpan.Zero);
Assert.IsTrue((_negativeOne).Minutes() < TimeSpan.Zero);
Assert.IsTrue((_negativeOne).Days() < TimeSpan.Zero);
Assert.IsTrue((_negativeOne).Hours() < TimeSpan.Zero);
Assert.IsTrue((_negativeOne).Weeks() < TimeSpan.Zero);
}
}