public void TestDurationConversion() { var test = new Duration(2, TimeUnit.Milliseconds); var converted = test.ConvertTo(TimeUnit.Microseconds); Check.That(converted.RawDuration).IsEqualTo(2000); Check.That(converted.Unit).IsEqualTo(TimeUnit.Microseconds); }
public void TestDurationConvertToFunction() { var durationA = new Duration <Hours, Int32>(333); var durationB = durationA.ConvertTo <Milliseconds, Decimal>(); Assert.AreEqual(1198800000, durationB.DurationValue); Assert.AreSame(typeof(Milliseconds), durationB.UnitOfMeasure.GetType()); var durationC = new Duration <Hours, Int32>(333); var durationD = durationC.ConvertTo <decimal>(); Assert.AreEqual(333, durationD.DurationValue); Assert.AreSame(typeof(decimal), durationD.DurationValue.GetType()); }