public string FormatGPSAccuracy(GPSAccuracy gpsAccuracy, int gpsTolerance) { if (gpsTolerance == CellPassConsts.NullGPSTolerance) { return(NullString); } var toleranceString = IsRawDataAsDBaseRequired ? FormatDisplayDistanceUnitless(gpsTolerance / 1000.000, false) : FormatDisplayDistance(gpsTolerance / 1000.000, false); return($"{FormatGPSAccuracyValue(gpsAccuracy)} ({toleranceString})"); }
private static GPSAccuracyType ConvertGpsAccuracy(GPSAccuracy cellPassGpsAccuracy) { switch (cellPassGpsAccuracy) { case GPSAccuracy.Fine: return(GPSAccuracyType.Fine); case GPSAccuracy.Medium: return(GPSAccuracyType.Medium); case GPSAccuracy.Coarse: return(GPSAccuracyType.Coarse); case GPSAccuracy.Unknown: return(GPSAccuracyType.Unknown); default: throw new ArgumentException($"Unknown GPSAccuracy type: {cellPassGpsAccuracy}"); } }
private string FormatGPSAccuracyValue(GPSAccuracy value) { string result; switch (value) { case GPSAccuracy.Fine: result = "Fine"; break; case GPSAccuracy.Medium: result = "Medium"; break; case GPSAccuracy.Coarse: result = "Coarse"; break; default: result = $"unknown: {value}"; break; } return(result); }
public void FormatGPSAccuracy(bool isRawDataAsDBaseRequired, UnitsTypeEnum units, GPSAccuracy gpsAccuracy, int gpsTolerance, string expectedResult) { var userPreferences = new UserPreferences() { Units = (int)units }; var csvUserPreference = AutoMapperUtility.Automapper.Map <CSVExportUserPreferences>(userPreferences); var formatter = new CSVExportFormatter(csvUserPreference, OutputTypes.PassCountLastPass, isRawDataAsDBaseRequired); var result = formatter.FormatGPSAccuracy(gpsAccuracy, gpsTolerance); result.Should().Be(expectedResult); }