1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-09 22:55:42 +00:00
X10D/X10D.Tests/src/Time/DoubleTests.cs

54 lines
1.7 KiB
C#
Raw Permalink Normal View History

using NUnit.Framework;
using X10D.Time;
namespace X10D.Tests.Time;
[TestFixture]
internal class DoubleTests
{
private Half _negativeOne;
private Half _one;
private Half _zero;
[SetUp]
public void Initialize()
{
_negativeOne = (Half)(-1);
_one = (Half)1;
_zero = (Half)0;
}
[Test]
public void TicksMillisecondsSecondsMinutesDaysHoursWeeks_ShouldBeZero_GivenZero()
{
Assert.That(_zero.Milliseconds(), Is.EqualTo(TimeSpan.Zero));
Assert.That(_zero.Seconds(), Is.EqualTo(TimeSpan.Zero));
Assert.That(_zero.Minutes(), Is.EqualTo(TimeSpan.Zero));
Assert.That(_zero.Days(), Is.EqualTo(TimeSpan.Zero));
Assert.That(_zero.Hours(), Is.EqualTo(TimeSpan.Zero));
Assert.That(_zero.Weeks(), Is.EqualTo(TimeSpan.Zero));
}
[Test]
public void TicksMillisecondsSecondsMinutesDaysHoursWeeks_ShouldBePositive_GivenOne()
{
Assert.That(_one.Milliseconds() > TimeSpan.Zero);
Assert.That(_one.Seconds() > TimeSpan.Zero);
Assert.That(_one.Minutes() > TimeSpan.Zero);
Assert.That(_one.Days() > TimeSpan.Zero);
Assert.That(_one.Hours() > TimeSpan.Zero);
Assert.That(_one.Weeks() > TimeSpan.Zero);
}
[Test]
public void TicksMillisecondsSecondsMinutesDaysHoursWeeks_ShouldBeNegative_GivenMinusOne()
{
Assert.That((_negativeOne).Milliseconds() < TimeSpan.Zero);
Assert.That((_negativeOne).Seconds() < TimeSpan.Zero);
Assert.That((_negativeOne).Minutes() < TimeSpan.Zero);
Assert.That((_negativeOne).Days() < TimeSpan.Zero);
Assert.That((_negativeOne).Hours() < TimeSpan.Zero);
Assert.That((_negativeOne).Weeks() < TimeSpan.Zero);
}
}