Exemplo n.º 1
0
 public void TestDurationValue()
 {
     Assert.AreEqual(10d, Duration.FromDay(10d).Day, DoubleDelta);
     Assert.AreEqual(10d, Duration.FromHour(10d).Hour, DoubleDelta);
     Assert.AreEqual(10d, Duration.FromMinute(10d).Minute, DoubleDelta);
     Assert.AreEqual(10d, Duration.FromSecond(10d).Second, DoubleDelta);
 }
Exemplo n.º 2
0
 public void TestDurationCalculation()
 {
     Assert.AreEqual(60d * 60d * 10d - 60d * 5d, (Duration.FromHour(10d) - Duration.FromMinute(5d)).Second, DoubleDelta);
     Assert.AreEqual(60d * 60d * 10d + 60d * 5d, (Duration.FromHour(10d) + Duration.FromMinute(5d)).Second, DoubleDelta);
 }
Exemplo n.º 3
0
 public void TestDurationConvert()
 {
     Assert.AreEqual(600d, Duration.FromHour(10d).Minute, DoubleDelta);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Calculates the time span for the given velocity and given distance covered length.<br/>
 /// <b>Calculates 1 / (v / l)</b>
 /// </summary>
 /// <param name="s">Velocity value</param>
 /// <param name="m">Length value</param>
 /// <returns>Time span</returns>
 public static Duration operator /(Velocity s, Length m) => Duration.FromHour(1 / (s.KilometerPerHour / m.GetMeter(UnitPrefix.Kilo)));