Exemple #1
0
        public void GetShortMinutesLattitudeTest()
        {
            var mcm = new MunichCoordinatesModel();
            var dms = new DMSCoordinate(mcm.DegreesLat, mcm.DegreesLon);

            decimal shortMinutesLat = dms.GetShortMinutesLattitude();

            decimal minutesLatDiff = Math.Abs(Math.Truncate(mcm.DdmMinsLat) - shortMinutesLat);

            var dict = new Dictionary <string, decimal>
            {
                { "minutesLatDiff", minutesLatDiff }
            };

            DisplayOutput("49", shortMinutesLat.ToString(), dict);

            Assert.IsTrue(minutesLatDiff <= 0.1m);
        }
Exemple #2
0
        public void CTOR_DDMtoDMS_Test()
        {
            var lcm = new LynnwoodCoordinatesModel();
            var dms = new DMSCoordinate(lcm.ShortDegreesLattitude(), lcm.DdmMinsLat, lcm.ShortDegreesLongitude(), lcm.DdmMinsLon);

            string expectedResult = LynnwoodCoordinatesModel.StrDMS();
            string actualResult   = dms.ToString();

            if (expectedResult != actualResult)
            {
                decimal latDiff = Math.Abs(dms.GetShortDegreesLat() - Math.Truncate(lcm.DegreesLat));
                decimal lonDiff = Math.Abs(dms.GetShortDegreesLon() - Math.Truncate(lcm.DegreesLon));

                decimal latMinsDiff = Math.Abs(dms.GetShortMinutesLattitude() - Math.Truncate(lcm.DdmMinsLat));
                decimal lonMinsDiff = Math.Abs(dms.GetShortMinutesLongitude() - Math.Truncate(lcm.DdmMinsLon));

                decimal latSecsDiff = Math.Abs(dms.GetSecondsLattitude() - lcm.DmsSecondsLat);
                decimal lonSecsDiff = Math.Abs(dms.GetSecondsLongitude() - lcm.DmsSecondsLon);

                var dict = new Dictionary <string, decimal>
                {
                    { "latDiff", latDiff },
                    { "lonDiff", lonDiff },
                    { "latMinsDiff", latMinsDiff },
                    { "lonMinsDiff", lonMinsDiff },
                    { "latSecsDiff", latSecsDiff },
                    { "lonSecsDiff", lonSecsDiff }
                };
                DisplayOutput(expectedResult, actualResult, dict);

                Assert.IsTrue(latDiff >= 0 && latDiff <= 0.0001m);
                Assert.IsTrue(latMinsDiff >= 0 && latMinsDiff <= 0.1m);
                Assert.IsTrue(latSecsDiff >= 0 && latSecsDiff <= 1.0m);

                Assert.IsTrue(lonDiff >= 0 && lonDiff <= 0.0001m);
                Assert.IsTrue(lonMinsDiff >= 0 && lonMinsDiff <= 0.1m);
                Assert.IsTrue(lonSecsDiff >= 0 && lonSecsDiff <= 1.0m);
            }
            else
            {
                Assert.AreEqual(expectedResult, actualResult);
            }
        }
Exemple #3
0
        public void CTOR_DDtoDMS_SW_Test()
        {
            var     mvcm  = new MontevideoCoordinateModel();
            decimal ddLat = mvcm.DegreesLat;
            decimal ddLon = mvcm.DegreesLon;

            var dms = new DMSCoordinate(ddLat, ddLon);

            string expectedResult = LynnwoodCoordinatesModel.StrDMS();
            string actualResult   = dms.ToString();

            decimal latDiff = Math.Abs(dms.GetShortDegreesLat() - Math.Truncate(mvcm.DegreesLat));
            decimal lonDiff = Math.Abs(dms.GetShortDegreesLon() - Math.Truncate(mvcm.DegreesLon));

            decimal latMinsDiff = Math.Abs(dms.GetShortMinutesLattitude() - Math.Truncate(mvcm.DdmMinsLat));
            decimal lonMinsDiff = Math.Abs(dms.GetShortMinutesLongitude() - Math.Truncate(mvcm.DdmMinsLon));

            decimal latSecsDiff = Math.Abs(dms.GetSecondsLattitude() - mvcm.DmsSecondsLat);
            decimal lonSecsDiff = Math.Abs(dms.GetSecondsLongitude() - mvcm.DmsSecondsLon);

            var dict = new Dictionary <string, decimal>
            {
                { "latDiff", latDiff },
                { "lonDiff", lonDiff },
                { "latMinsDiff", latMinsDiff },
                { "lonMinsDiff", lonMinsDiff },
                { "latSecsDiff", latSecsDiff },
                { "lonSecsDiff", lonSecsDiff }
            };

            DisplayOutput(expectedResult, actualResult, dict);

            Assert.IsTrue(latDiff >= 0 && latDiff <= 0.0001m);
            Assert.IsTrue(latMinsDiff >= 0 && latMinsDiff <= 0.1m);
            Assert.IsTrue(latSecsDiff >= 0 && latSecsDiff <= 1.0m);

            Assert.IsTrue(lonDiff >= 0 && lonDiff <= 0.0001m);
            Assert.IsTrue(lonMinsDiff >= 0 && lonMinsDiff <= 0.1m);
            Assert.IsTrue(lonSecsDiff >= 0 && lonSecsDiff <= 1.0m);
        }