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 SolarDeclinationComparisonTest(SolarCalculationsTestData item)
        {
            SolarTimes solarTimes    = TestDirector.SolarTimesInstance(item);
            decimal    expectedValue = item.SunDeclin;
            decimal    actualValue   = solarTimes.SolarDeclination;

            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 SunGeometricMeanLongitudeComparisonTest(SolarCalculationsTestData item)
        {
            SolarTimes solarTimes    = TestDirector.SolarTimesInstance(item);
            decimal    expectedValue = item.GeomMeanLongSun;
            decimal    actualValue   = solarTimes.SunGeometricMeanLongitude;

            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 MeanEclipticObliquityComparisonTest(SolarCalculationsTestData item)
        {
            SolarTimes solarTimes    = TestDirector.SolarTimesInstance(item);
            decimal    expectedValue = item.MeanObliqEcliptic;
            decimal    actualValue   = solarTimes.MeanEclipticObliquity;

            CustomAssert.AreEqual(expectedValue, actualValue, TestDirector.SolarDecimalDelta);
        }
Ejemplo n.º 7
0
        public void ObliquityCorrectionComparisonTest()
        {
            SolarTimes solarTimes    = TestDirector.SolarTimesInstance(this.TestContext.DataRow);
            decimal    expectedValue = Convert.ToDecimal(this.TestContext.DataRow["ObliqCorr"]);
            decimal    actualValue   = solarTimes.ObliquityCorrection;
            decimal    difference    = expectedValue - actualValue;

            CustomAssert.AreEqual(expectedValue, actualValue, TestDirector.SolarDecimalDelta);
        }
Ejemplo n.º 8
0
        public void EccentricityOfEarthOrbitComparisonTest()
        {
            SolarTimes solarTimes    = TestDirector.SolarTimesInstance(this.TestContext.DataRow);
            decimal    expectedValue = Convert.ToDecimal(this.TestContext.DataRow["EccentEarthOrbit"]);
            decimal    actualValue   = solarTimes.EccentricityOfEarthOrbit;
            decimal    difference    = expectedValue - actualValue;

            CustomAssert.AreEqual(expectedValue, actualValue, TestDirector.SolarDecimalDelta);
        }
Ejemplo n.º 9
0
        public void SunMeanAnomalyComparisonTest()
        {
            SolarTimes solarTimes    = TestDirector.SolarTimesInstance(this.TestContext.DataRow);
            decimal    expectedValue = Convert.ToDecimal(this.TestContext.DataRow["GeomMeanAnomSun"]);
            decimal    actualValue   = solarTimes.SunMeanAnomaly;
            decimal    difference    = expectedValue - actualValue;

            CustomAssert.AreEqual(expectedValue, actualValue, TestDirector.SolarDecimalDelta);
        }
Ejemplo n.º 10
0
        public void JulianCenturyComparisonTest()
        {
            SolarTimes solarTimes    = TestDirector.SolarTimesInstance(this.TestContext.DataRow);
            decimal    expectedValue = Convert.ToDecimal(this.TestContext.DataRow["JulianCentury"]);
            decimal    actualValue   = solarTimes.JulianCentury;
            decimal    difference    = expectedValue - actualValue;

            CustomAssert.AreEqual(expectedValue, actualValue, TestDirector.SolarDecimalDelta);
        }
Ejemplo n.º 11
0
        public void HourAngleSunriseComparisonTest()
        {
            SolarTimes solarTimes    = TestDirector.SolarTimesInstance(this.TestContext.DataRow);
            decimal    expectedValue = Convert.ToDecimal(this.TestContext.DataRow["HaSunrise"]);
            decimal    actualValue   = solarTimes.HourAngleSunrise;
            decimal    difference    = expectedValue - actualValue;

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

            CustomAssert.AreEqual(expectedValue, actualValue, TestDirector.SolarDecimalDelta);
        }
Ejemplo n.º 13
0
        public void SunApparentLongitudeComparisonTest()
        {
            SolarTimes solarTimes    = TestDirector.SolarTimesInstance(this.TestContext.DataRow);
            decimal    expectedValue = Convert.ToDecimal(this.TestContext.DataRow["SunAppLong"]);
            decimal    actualValue   = solarTimes.SunApparentLongitude;
            decimal    difference    = expectedValue - actualValue;

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

            CustomAssert.AreEqual(expectedValue, actualValue, TestDirector.SolarDecimalDelta);
        }
        public void ObliquityCorrectionComparisonTest(SolarCalculationsTestData item)
        {
            SolarTimes solarTimes    = TestDirector.SolarTimesInstance(item);
            decimal    expectedValue = item.ObliqCorr;
            decimal    actualValue   = solarTimes.ObliquityCorrection;
            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}");
            }
        }
Ejemplo n.º 18
0
        public void SunsetComparisonTest()
        {
            SolarTimes solarTimes    = TestDirector.SolarTimesInstance(this.TestContext.DataRow);
            DateTime   expectedValue = Convert.ToDateTime(this.TestContext.DataRow["SunsetTime"]);
            DateTime   actualValue   = solarTimes.Sunset;
            TimeSpan   difference    = expectedValue.TimeOfDay.Subtract(actualValue.TimeOfDay);

            if (difference > TestDirector.TimeSpanDelta)
            {
                Assert.Fail(string.Format("The Sunset (Column Z) calculation does not match Excel. The difference is {0}", difference));
            }
        }
Ejemplo n.º 19
0
        public void SunlightDurationComparisonTest()
        {
            SolarTimes solarTimes    = TestDirector.SolarTimesInstance(this.TestContext.DataRow);
            TimeSpan   expectedValue = TimeSpan.FromMinutes(Convert.ToDouble(this.TestContext.DataRow["SunlightDuration"]));
            TimeSpan   actualValue   = solarTimes.SunlightDuration;
            TimeSpan   difference    = expectedValue - actualValue;

            if (difference > TestDirector.TimeSpanDelta)
            {
                Assert.Fail(string.Format("The Sunlight Duration (Column AA) calculation does not match Excel. The difference is {0}", difference));
            }
        }
Ejemplo n.º 20
0
        public static IEnumerable <DateValueTestData> LoadDateValueTestData()
        {
            IEnumerable <DateValueTestData> returnValue = null;

            string contents = File.ReadAllText(@"Data/DateValueTestData.csv");

            // ***
            // ***
            // ***
            returnValue = (from tbl in TestDirector.ParseCsv(contents)
                           select new DateValueTestData()
            {
                Date = DateTime.Parse(tbl["Date"]),
                DateValue = Convert.ToDecimal(tbl["DateValue"])
            }).ToArray();

            return(returnValue);
        }
Ejemplo n.º 21
0
        public static IEnumerable <SolarCalculationsTestData> LoadSolarCalculatorTestData()
        {
            IEnumerable <SolarCalculationsTestData> returnValue = null;

            string contents = File.ReadAllText(@"Data/SolarCalculationsTestData.csv");

            // ***
            // ***
            // ***
            returnValue = (from tbl in TestDirector.ParseCsv(contents)
                           select new SolarCalculationsTestData()
            {
                Date = DateTime.Parse(tbl["Date"]),
                Time = DateTime.Parse(tbl["Time"]),
                TimeZoneOffset = Convert.ToInt32(tbl["TimeZoneOffset"]),
                Latitude = Convert.ToDecimal(tbl["Latitude"]),
                Longitude = Convert.ToDecimal(tbl["Longitude"]),
                JulianDay = Convert.ToDecimal(tbl["JulianDay"]),
                JulianCentury = Convert.ToDecimal(tbl["JulianCentury"]),
                GeomMeanLongSun = Convert.ToDecimal(tbl["GeomMeanLongSun"]),
                GeomMeanAnomSun = Convert.ToDecimal(tbl["GeomMeanAnomSun"]),
                EccentEarthOrbit = Convert.ToDecimal(tbl["EccentEarthOrbit"]),
                SunEqofCtr = Convert.ToDecimal(tbl["SunEqofCtr"]),
                SunTrueLong = Convert.ToDecimal(tbl["SunTrueLong"]),
                SunAppLong = Convert.ToDecimal(tbl["SunAppLong"]),
                MeanObliqEcliptic = Convert.ToDecimal(tbl["MeanObliqEcliptic"]),
                ObliqCorr = Convert.ToDecimal(tbl["ObliqCorr"]),
                SunDeclin = Convert.ToDecimal(tbl["SunDeclin"]),
                Vary = Convert.ToDecimal(tbl["vary"]),
                EqofTime = Convert.ToDecimal(tbl["EqofTime"]),
                HaSunrise = Convert.ToDecimal(tbl["HaSunrise"]),
                SolarNoon = DateTime.Parse(tbl["SolarNoon"]),
                SunriseTime = DateTime.Parse(tbl["SunriseTime"]),
                SunsetTime = DateTime.Parse(tbl["SunsetTime"]),
                SunlightDuration = Convert.ToDouble(tbl["SunlightDuration"]),
                TrueSolarTime = Convert.ToDecimal(tbl["TrueSolarTime"])
            }).ToArray();

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

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