Example #1
0
        public void TestAddition()
        {
            JulianDate original = new JulianDate(2460000, 1000.0);
            Duration   toAdd    = Duration.FromSeconds(50.0);
            JulianDate added    = original.Add(toAdd);

            Assert.AreEqual(2460000, added.Day);
            Assert.AreEqual(1050.0, added.SecondsOfDay);
            JulianDate subtracted = original.Subtract(toAdd);

            Assert.AreEqual(2460000, subtracted.Day);
            Assert.AreEqual(950.0, subtracted.SecondsOfDay);

            original = new JulianDate(2460000, 8382.1);
            toAdd    = new Duration(1, 10.0);
            added    = original + toAdd;
            Assert.AreEqual(2460001, added.Day);
            Assert.AreEqual(8392.1, added.SecondsOfDay);
            subtracted = original - toAdd;
            Assert.AreEqual(2459999, subtracted.Day);
            Assert.AreEqual(8372.1, subtracted.SecondsOfDay);

            original = new JulianDate(2460000, 86000.0);
            toAdd    = Duration.FromSeconds(1000.0);
            added    = original.Add(toAdd);
            Assert.AreEqual(2460001, added.Day);
            Assert.AreEqual(600.0, added.SecondsOfDay);
            subtracted = original.Subtract(toAdd);
            Assert.AreEqual(2460000, subtracted.Day);
            Assert.AreEqual(85000.0, subtracted.SecondsOfDay);
        }
Example #2
0
        public void TestAddition()
        {
            JulianDate original = new JulianDate(2460000, 1000.0);
            Duration toAdd = Duration.FromSeconds(50.0);
            JulianDate added = original.Add(toAdd);
            Assert.AreEqual(2460000, added.Day);
            Assert.AreEqual(1050.0, added.SecondsOfDay);
            JulianDate subtracted = original.Subtract(toAdd);
            Assert.AreEqual(2460000, subtracted.Day);
            Assert.AreEqual(950.0, subtracted.SecondsOfDay);

            original = new JulianDate(2460000, 8382.1);
            toAdd = new Duration(1, 10.0);
            added = original + toAdd;
            Assert.AreEqual(2460001, added.Day);
            Assert.AreEqual(8392.1, added.SecondsOfDay);
            subtracted = original - toAdd;
            Assert.AreEqual(2459999, subtracted.Day);
            Assert.AreEqual(8372.1, subtracted.SecondsOfDay);

            original = new JulianDate(2460000, 86000.0);
            toAdd = Duration.FromSeconds(1000.0);
            added = original.Add(toAdd);
            Assert.AreEqual(2460001, added.Day);
            Assert.AreEqual(600.0, added.SecondsOfDay);
            subtracted = original.Subtract(toAdd);
            Assert.AreEqual(2460000, subtracted.Day);
            Assert.AreEqual(85000.0, subtracted.SecondsOfDay);
        }