public void ConvertGridsquareToDDMTestNE() { var mcm = new MunichCoordinatesModel(); var cc = new GridDdmExpert(); string gridsquare = MunichCoordinatesModel.StrGridSquare(); var expectedResult = new DDMCoordinate(mcm.DegreesLat, mcm.DdmMinsLat, mcm.DegreesLon, mcm.DdmMinsLon); DDMCoordinate actualResult = cc.ConvertGridsquareToDDM(gridsquare); decimal latDiff = Math.Abs(expectedResult.GetShortDegreesLat() - actualResult.GetShortDegreesLat()); decimal lonDiff = Math.Abs(expectedResult.GetShortDegreesLon() - actualResult.GetShortDegreesLon()); decimal latMinsDiff = Math.Abs(expectedResult.GetMinsLat() - actualResult.GetMinsLat()); decimal lonMinsDiff = Math.Abs(expectedResult.GetMinsLon() - actualResult.GetMinsLon()); var dict = new Dictionary <string, decimal> { { "latDiff", latDiff }, { "lonDiff", lonDiff }, { "latMinsDiff", latMinsDiff }, { "lonMinsDiff", lonMinsDiff } }; DisplayOutput(expectedResult.ToString(), actualResult.ToString(), dict); Assert.IsTrue(latDiff >= 0 && latDiff <= DegreeAccuracyThreshold); Assert.IsTrue(latMinsDiff >= 0 && latMinsDiff <= LatMinsAccuracyThreshold); Assert.IsTrue(lonDiff >= 0 && lonDiff <= DegreeAccuracyThreshold); Assert.IsTrue(lonMinsDiff >= 0 && lonMinsDiff <= LonMinsAccuracyThreshold); }
public void ConvertDDMtoGridsquareTest_NE() { var mcm = new MunichCoordinatesModel(); decimal degreesLat = Math.Truncate(mcm.DegreesLat); decimal degreesLon = Math.Truncate(mcm.DegreesLon); decimal minutesLat = mcm.DdmMinsLat; decimal minutesLon = mcm.DdmMinsLon; var ddm = new DDMCoordinate(degreesLat, minutesLat, degreesLon, minutesLon); var cc = new GridDdmExpert(); string expectedResult = MunichCoordinatesModel.StrGridSquare(); string actualResult = cc.ConvertDDMtoGridsquare(ddm); Assert.AreEqual(expectedResult, actualResult); }