public void CheckSolarNoonDate(SolarCalculationsTestData item)
        {
            SolarTimes solarTimes = TestDirector.SolarTimesInstance(item);

            //Assert.AreEqual(solarTimes.ForDate.Date, solarTimes.SolarNoon.Date);
            Assert.Inconclusive("Disabled until further research can be done.");
        }
        public void SunTrueLongitudeComparisonTest(SolarCalculationsTestData item)
        {
            SolarTimes solarTimes    = TestDirector.SolarTimesInstance(item);
            decimal    expectedValue = item.SunTrueLong;
            decimal    actualValue   = solarTimes.SunTrueLongitude;

            CustomAssert.AreEqual(expectedValue, actualValue, TestDirector.SolarDecimalDelta);
        }
        public void SunEquationOfCenterComparisonTest(SolarCalculationsTestData item)
        {
            SolarTimes solarTimes    = TestDirector.SolarTimesInstance(item);
            decimal    expectedValue = item.SunEqofCtr;
            decimal    actualValue   = solarTimes.SunEquationOfCenter;

            CustomAssert.AreEqual(expectedValue, actualValue, TestDirector.SolarDecimalDelta);
        }
        public void EccentricityOfEarthOrbitComparisonTest(SolarCalculationsTestData item)
        {
            SolarTimes solarTimes    = TestDirector.SolarTimesInstance(item);
            decimal    expectedValue = item.EccentEarthOrbit;
            decimal    actualValue   = solarTimes.EccentricityOfEarthOrbit;

            CustomAssert.AreEqual(expectedValue, actualValue, TestDirector.SolarDecimalDelta);
        }
        public void SunMeanAnomalyComparisonTest(SolarCalculationsTestData item)
        {
            SolarTimes solarTimes    = TestDirector.SolarTimesInstance(item);
            decimal    expectedValue = item.GeomMeanAnomSun;
            decimal    actualValue   = solarTimes.SunMeanAnomaly;

            CustomAssert.AreEqual(expectedValue, actualValue, TestDirector.SolarDecimalDelta);
        }
        public void JulianCenturyComparisonTest(SolarCalculationsTestData item)
        {
            SolarTimes solarTimes    = TestDirector.SolarTimesInstance(item);
            decimal    expectedValue = item.JulianCentury;
            decimal    actualValue   = solarTimes.JulianCentury;

            CustomAssert.AreEqual(expectedValue, actualValue, TestDirector.SolarDecimalDelta);
        }
        public void HourAngleSunriseComparisonTest(SolarCalculationsTestData item)
        {
            SolarTimes solarTimes    = TestDirector.SolarTimesInstance(item);
            decimal    expectedValue = item.HaSunrise;
            decimal    actualValue   = solarTimes.HourAngleSunrise;

            CustomAssert.AreEqual(expectedValue, actualValue, TestDirector.SolarDecimalDelta);
        }
        public void ObliquityCorrectionComparisonTest(SolarCalculationsTestData item)
        {
            SolarTimes solarTimes    = TestDirector.SolarTimesInstance(item);
            decimal    expectedValue = item.ObliqCorr;
            decimal    actualValue   = solarTimes.ObliquityCorrection;

            CustomAssert.AreEqual(expectedValue, actualValue, TestDirector.SolarDecimalDelta);
        }
        public void MeanEclipticObliquityComparisonTest(SolarCalculationsTestData item)
        {
            SolarTimes solarTimes    = TestDirector.SolarTimesInstance(item);
            decimal    expectedValue = item.MeanObliqEcliptic;
            decimal    actualValue   = solarTimes.MeanEclipticObliquity;

            CustomAssert.AreEqual(expectedValue, actualValue, TestDirector.SolarDecimalDelta);
        }
        public void SunGeometricMeanLongitudeComparisonTest(SolarCalculationsTestData item)
        {
            SolarTimes solarTimes    = TestDirector.SolarTimesInstance(item);
            decimal    expectedValue = item.GeomMeanLongSun;
            decimal    actualValue   = solarTimes.SunGeometricMeanLongitude;
            decimal    difference    = expectedValue - actualValue;

            CustomAssert.AreEqual(expectedValue, actualValue, TestDirector.SolarDecimalDelta);
        }
        public void TrueSolarTimeComparisonTest(SolarCalculationsTestData item)
        {
            SolarTimes solarTimes    = TestDirector.SolarTimesInstance(item);
            decimal    expectedValue = item.TrueSolarTime;
            decimal    actualValue   = solarTimes.TrueSolarTime;
            decimal    difference    = expectedValue - actualValue;

            CustomAssert.AreEqual(expectedValue, actualValue, TestDirector.SolarDecimalDelta);
        }
        public void SunlightDurationComparisonTest(SolarCalculationsTestData item)
        {
            SolarTimes solarTimes    = TestDirector.SolarTimesInstance(item);
            TimeSpan   expectedValue = TimeSpan.FromMinutes(item.SunlightDuration);
            TimeSpan   actualValue   = solarTimes.SunlightDuration;
            TimeSpan   difference    = expectedValue - actualValue;

            if (difference > TestDirector.TimeSpanDelta)
            {
                Assert.Fail($"The Sunlight Duration (Column AA) calculation does not match Excel. The difference is {difference}");
            }
        }
        public void SunsetComparisonTest(SolarCalculationsTestData item)
        {
            SolarTimes solarTimes    = TestDirector.SolarTimesInstance(item);
            DateTime   expectedValue = item.SunsetTime;
            DateTime   actualValue   = solarTimes.Sunset;
            TimeSpan   difference    = expectedValue.TimeOfDay.Subtract(actualValue.TimeOfDay);

            if (difference > TestDirector.TimeSpanDelta)
            {
                Assert.Fail($"The Sunset (Column Z) calculation does not match Excel. The difference is {difference}");
            }
        }
        /// <summary>
        /// Creates a SolarTimes instance for use in tests from an instance
        /// of SolarCalculatorTestData.
        /// </summary>
        public static SolarTimes SolarTimesInstance(SolarCalculationsTestData item)
        {
            SolarTimes returnValue = null;

            TimeSpan tzOffset = TimeSpan.FromHours(item.TimeZoneOffset);

            returnValue = new SolarTimes()
            {
                Latitude  = Convert.ToDouble(item.Latitude),
                Longitude = Convert.ToDouble(item.Longitude),
                ForDate   = new DateTimeOffset(item.Date.Add(item.Time.TimeOfDay), tzOffset)
            };

            return(returnValue);
        }
        public void CheckSunriseDate(SolarCalculationsTestData item)
        {
            SolarTimes solarTimes = TestDirector.SolarTimesInstance(item);

            Assert.AreEqual(solarTimes.ForDate.Date, solarTimes.Sunrise.Date);
        }