2022-04-21 21:37:20 +01:00
|
|
|
|
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]
|
2022-04-25 17:09:49 +01:00
|
|
|
|
public void TicksMillisecondsSecondsMinutesDaysHoursWeeks_ShouldBeZero_GivenZero()
|
2022-04-21 21:37:20 +01:00
|
|
|
|
{
|
|
|
|
|
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]
|
2022-04-25 17:09:49 +01:00
|
|
|
|
public void TicksMillisecondsSecondsMinutesDaysHoursWeeks_ShouldBePositive_GivenOne()
|
2022-04-21 21:37:20 +01:00
|
|
|
|
{
|
|
|
|
|
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]
|
2022-04-25 17:09:49 +01:00
|
|
|
|
public void TicksMillisecondsSecondsMinutesDaysHoursWeeks_ShouldBeNegative_GivenMinusOne()
|
2022-04-21 21:37:20 +01:00
|
|
|
|
{
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
}
|