public void CTOR_DMS_Test() { var mcm = new MunichCoordinatesModel(); decimal latDegrees = mcm.ShortDegreesLattitude(); decimal latMinutes = Math.Truncate(mcm.DdmMinsLat); decimal latSeconds = mcm.DmsSecondsLat; decimal lonDegrees = mcm.ShortDegreesLongitude(); decimal lonMinutes = Math.Truncate(mcm.DdmMinsLon); decimal lonSeconds = mcm.DmsSecondsLon; var dd = new DDCoordinate(latDegrees, latMinutes, latSeconds, lonDegrees, lonMinutes, lonSeconds); string expectedResult = MunichCoordinatesModel.StrDD(); string actualResult = dd.ToString(); decimal latDiff = Math.Abs(dd.GetLattitudeDD() - mcm.DegreesLat); decimal lonDiff = Math.Abs(dd.GetLongitudeDD() - mcm.DegreesLon); var dict = new Dictionary <string, decimal> { { "latDiff", latDiff }, { "lonDiff", lonDiff } }; DisplayOutput(expectedResult, actualResult, dict); Assert.IsTrue(latDiff >= 0 && latDiff <= DegreeAccuracyThreshold); Assert.IsTrue(lonDiff >= 0 && lonDiff <= DegreeAccuracyThreshold); }
public void CTOR_DD_Test() { var mvcm = new MunichCoordinatesModel(); decimal ddLat = mvcm.DegreesLat; decimal ddLon = mvcm.DegreesLon; var dd = new DDCoordinate(ddLat, ddLon); string expectedResult = MunichCoordinatesModel.StrDDM(); string actualResult = dd.ToString(); decimal latDiff = Math.Abs(dd.GetLattitudeDD() - mvcm.DegreesLat); decimal lonDiff = Math.Abs(dd.GetLongitudeDD() - mvcm.DegreesLon); var dict = new Dictionary <string, decimal> { { "latDiff", latDiff }, { "lonDiff", lonDiff } }; DisplayOutput(expectedResult, actualResult, dict); Assert.IsTrue(latDiff >= 0 && latDiff <= DegreeAccuracyThreshold); Assert.IsTrue(lonDiff >= 0 && lonDiff <= DegreeAccuracyThreshold); }
public void DmsToDD_SW_Test() { var mvcm = new MontevideoCoordinateModel(); var dd = new DDCoordinate( mvcm.ShortDegreesLattitude(), mvcm.DdmMinsLat, mvcm.DmsSecondsLat, mvcm.ShortDegreesLongitude(), mvcm.DdmMinsLon, mvcm.DmsSecondsLon ); string expectedResult = MontevideoCoordinateModel.StrDD(); int expectedLength = expectedResult.Length; string actualResult = dd.ToString(); int actualLength = actualResult.Length; decimal latDiff = Math.Abs(dd.GetLattitudeDD() - mvcm.DegreesLat); decimal lonDiff = Math.Abs(dd.GetLongitudeDD() - mvcm.DegreesLon); var dict = new Dictionary <string, decimal> { { "latDiff", latDiff }, { "lonDiff", lonDiff } }; DisplayOutput(expectedResult, actualResult, dict); Assert.AreEqual(expectedLength, actualLength); Assert.IsTrue(latDiff >= 0 && latDiff <= DegreeAccuracyThreshold); Assert.IsTrue(lonDiff >= 0 && lonDiff <= DegreeAccuracyThreshold); }
public void DdToDD_SE_Test() { var wcm = new WellingtonCoordinateModel(); var dd = new DDCoordinate(wcm.DegreesLat, wcm.DegreesLon); string expectedResult = WellingtonCoordinateModel.StrDD(); int expectedLength = expectedResult.Length; string actualResult = dd.ToString(); int actualLength = actualResult.Length; decimal latDiff = Math.Abs(dd.GetLattitudeDD() - wcm.DegreesLat); decimal lonDiff = Math.Abs(dd.GetLongitudeDD() - wcm.DegreesLon); var dict = new Dictionary <string, decimal> { { "latDiff", latDiff }, { "lonDiff", lonDiff } }; DisplayOutput(expectedResult, actualResult, dict); Assert.AreEqual(expectedLength, actualLength); Assert.IsTrue(latDiff >= 0 && latDiff <= DegreeAccuracyThreshold); Assert.IsTrue(lonDiff >= 0 && lonDiff <= DegreeAccuracyThreshold); }