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 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); }