Beispiel #1
0
        public void TestEqualsEpsilonExact()
        {
            JulianDate first  = new JulianDate(2451545, 0.2);
            JulianDate second = new JulianDate(2451545, 0.2);

            Assert.IsTrue(second.EqualsEpsilon(first, 0));
        }
Beispiel #2
0
        public void TestLocalDateTimeToJulian()
        {
            DateTime localNow = DateTime.Now;
            DateTime utcNow   = localNow.ToUniversalTime();

            JulianDate localJulianDate = new JulianDate(localNow);
            JulianDate utcJulianDate   = new JulianDate(utcNow);

            Assert.IsTrue(localJulianDate.EqualsEpsilon(utcJulianDate, Constants.Epsilon14));

            localNow = DateTime.Now;
            utcNow   = localNow.ToUniversalTime();

            localJulianDate = new JulianDate(localNow, TimeStandard.InternationalAtomicTime);
            utcJulianDate   = new JulianDate(utcNow, TimeStandard.InternationalAtomicTime);

            Assert.IsTrue(localJulianDate.EqualsEpsilon(utcJulianDate, Constants.Epsilon14));
        }
Beispiel #3
0
        public void TestEquality()
        {
            JulianDate first  = new JulianDate(2451545, 0.2);
            JulianDate second = new JulianDate(2451545, 0.2);

            Assert.AreEqual(first, second);
            Assert.IsTrue(first.Equals(second));
            Assert.IsTrue(second.Equals(first));
            Assert.AreEqual(0, first.CompareTo(second));
            Assert.AreEqual(0, second.CompareTo(first));
            Assert.AreNotEqual(first, 5);

            first  = new JulianDate(2451545, 0.00001);
            second = new JulianDate(2451544, 86399.99999);
            Assert.AreNotEqual(first, second);
            Assert.IsFalse(first.Equals(second));
            Assert.IsFalse(second.Equals(first));
            Assert.AreNotEqual(0, first.CompareTo(second));
            Assert.AreNotEqual(0, second.CompareTo(first));
            Assert.IsTrue(first.EqualsEpsilon(second, 1e-4));
            Assert.IsTrue(second.EqualsEpsilon(first, 1e-4));
        }
        public void TestLocalDateTimeToJulian()
        {
            DateTime localNow = DateTime.Now;
            DateTime utcNow = localNow.ToUniversalTime();

            JulianDate localJD = new JulianDate(localNow);
            JulianDate utcJD = new JulianDate(utcNow);

            Assert.IsTrue(localJD.EqualsEpsilon(utcJD, Constants.Epsilon14));

            localNow = DateTime.Now;
            utcNow = localNow.ToUniversalTime();

            localJD = new JulianDate(localNow, TimeStandard.InternationalAtomicTime);
            utcJD = new JulianDate(utcNow, TimeStandard.InternationalAtomicTime);

            Assert.IsTrue(localJD.EqualsEpsilon(utcJD, Constants.Epsilon14));
        }
Beispiel #5
0
        public void TestEquality()
        {
            JulianDate first = new JulianDate(2451545, 0.2);
            JulianDate second = new JulianDate(2451545, 0.2);
            Assert.AreEqual(first, second);
            Assert.IsTrue(first.Equals(second));
            Assert.IsTrue(second.Equals(first));
            Assert.AreEqual(0, first.CompareTo(second));
            Assert.AreEqual(0, second.CompareTo(first));
            Assert.AreNotEqual(first, 5);

            first = new JulianDate(2451545, 0.00001);
            second = new JulianDate(2451544, 86399.99999);
            Assert.AreNotEqual(first, second);
            Assert.IsFalse(first.Equals(second));
            Assert.IsFalse(second.Equals(first));
            Assert.AreNotEqual(0, first.CompareTo(second));
            Assert.AreNotEqual(0, second.CompareTo(first));
            Assert.IsTrue(first.EqualsEpsilon(second, 1e-4));
            Assert.IsTrue(second.EqualsEpsilon(first, 1e-4));
        }