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 DmsToDD_NE_Test() { var mcm = new MunichCoordinatesModel(); var dd = new DDCoordinate( mcm.ShortDegreesLattitude(), mcm.DdmMinsLat, mcm.DmsSecondsLat, mcm.ShortDegreesLongitude(), mcm.DdmMinsLon, mcm.DmsSecondsLon ); string expectedResult = MunichCoordinatesModel.StrDD(); int expectedLength = expectedResult.Length; string actualResult = dd.ToString(); int actualLength = actualResult.Length; 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.AreEqual(expectedLength, actualLength); Assert.IsTrue(latDiff >= 0 && latDiff <= DegreeAccuracyThreshold); Assert.IsTrue(lonDiff >= 0 && lonDiff <= DegreeAccuracyThreshold); }
public void GetShortDegreesLonTest() { var mcm = new MunichCoordinatesModel(); var dd = new DDCoordinate(mcm.DegreesLat, mcm.DegreesLon); decimal expectedResult = mcm.ShortDegreesLongitude(); decimal actualResult = dd.GetShortDegreesLon(); Assert.AreEqual(expectedResult, actualResult); }