public void ConvertGridsquareToDDMTestSE() { var mvcm = new MontevideoCoordinateModel(); var cc = new GridDdmExpert(); string gridsquare = MontevideoCoordinateModel.StrGridsquare(); var expectedResult = new DDMCoordinate(mvcm.ShortDegreesLattitude(), mvcm.DdmMinsLat, mvcm.ShortDegreesLongitude(), mvcm.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_SW() { var mcm = new MontevideoCoordinateModel(); 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 = MontevideoCoordinateModel.StrGridsquare(); string actualResult = cc.ConvertDDMtoGridsquare(ddm); Assert.AreEqual(expectedResult, actualResult); }