public void FormatEventVibrationState_Unknown() { var userPreferences = new UserPreferences(); var csvUserPreference = AutoMapperUtility.Automapper.Map <CSVExportUserPreferences>(userPreferences); var formatter = new CSVExportFormatter(csvUserPreference, OutputTypes.PassCountLastPass); var result = formatter.FormatEventVibrationState((VibrationState)100); result.Should().Be("unknown: 100"); }
public void FormatMachineGear_NoEnumValue() { var userPreferences = new UserPreferences(); var csvUserPreference = AutoMapperUtility.Automapper.Map <CSVExportUserPreferences>(userPreferences); var formatter = new CSVExportFormatter(csvUserPreference, OutputTypes.PassCountLastPass); var result = formatter.FormatMachineGearValue((MachineGear)100); result.Should().Be("unknown: 100"); }
public void FormatEventVibrationState(VibrationState value, string expectedResult) { var userPreferences = new UserPreferences(); var csvUserPreference = AutoMapperUtility.Automapper.Map <CSVExportUserPreferences>(userPreferences); var formatter = new CSVExportFormatter(csvUserPreference, OutputTypes.PassCountLastPass); var result = formatter.FormatEventVibrationState(value); result.Should().Be(expectedResult); }
public void FormatAmplitude(bool isRawDataAsDBaseRequired, ushort value, string expectedResult) { var userPreferences = new UserPreferences(); var csvUserPreference = AutoMapperUtility.Automapper.Map <CSVExportUserPreferences>(userPreferences); var formatter = new CSVExportFormatter(csvUserPreference, OutputTypes.PassCountLastPass, isRawDataAsDBaseRequired); var result = formatter.FormatAmplitude(value); result.Should().Be(expectedResult); }
public void FormatSpeed(bool isRawDataAsDBaseRequired, UnitsTypeEnum units, int speed, 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.FormatSpeed(speed); result.Should().Be(expectedResult); }
public void FormatLastPassValidTemperature(TemperatureUnitEnum temperatureUnits, ushort value, string expectedResult) { var userPreferences = new UserPreferences() { TemperatureUnits = (int)temperatureUnits }; var csvUserPreference = AutoMapperUtility.Automapper.Map <CSVExportUserPreferences>(userPreferences); var formatter = new CSVExportFormatter(csvUserPreference, OutputTypes.PassCountLastPass); var result = formatter.FormatLastPassValidTemperature(value); result.Should().Be(expectedResult); }
public void CellPassDateToString (string dateSeparator, string timeSeparator, string decimalSeparator, OutputTypes outputType, string value, double timeZoneOffset, string expectedResult) { DateTime valueDateTime = DateTime.SpecifyKind(DateTime.Parse(value), DateTimeKind.Utc); var userPreferences = new UserPreferences( "", dateSeparator, timeSeparator, ",", decimalSeparator, timeZoneOffset, 0, 1, 0, 1, 1, 1); var csvUserPreference = AutoMapperUtility.Automapper.Map <CSVExportUserPreferences>(userPreferences); var formatter = new CSVExportFormatter(csvUserPreference, outputType, false); var result = formatter.FormatCellPassTime(valueDateTime); result.Should().Be(expectedResult); }
public void FormatElevationString (string decimalSeparator, string thousandsSeparator, UnitsTypeEnum units, bool isRawDataAsDBaseRequired, float value, string expectedResult ) { var userPreferences = new UserPreferences() { DecimalSeparator = decimalSeparator, ThousandsSeparator = thousandsSeparator, Units = (int)units }; var csvUserPreference = AutoMapperUtility.Automapper.Map <CSVExportUserPreferences>(userPreferences); OutputTypes outputType = OutputTypes.PassCountLastPass; var formatter = new CSVExportFormatter(csvUserPreference, outputType, isRawDataAsDBaseRequired); var result = formatter.FormatElevation(value); result.Should().Be(expectedResult); }
public void FormatterInitializationDefault() { var userPreferences = DefaultUserPreferences(); var csvUserPreference = AutoMapperUtility.Automapper.Map <CSVExportUserPreferences>(userPreferences); OutputTypes outputType = OutputTypes.PassCountAllPasses; var formatter = new CSVExportFormatter(csvUserPreference, outputType, false); formatter.UserPreference.DateSeparator.Should().Be("/"); formatter.UserPreference.TimeSeparator.Should().Be(":"); formatter.UserPreference.DecimalSeparator.Should().Be("."); formatter.UserPreference.ThousandsSeparator.Should().Be(","); formatter.OutputType.Should().Be(outputType); formatter.IsRawDataAsDBaseRequired.Should().Be(false); formatter.NullString.Should().Be("?"); formatter.UserPreference.Units.Should().Be(UnitsTypeEnum.Metric); formatter.DistanceConversionFactor.Should().Be(1.0); formatter.SpeedUnitString.Should().Be("km/h"); formatter.SpeedConversionFactor.Should().Be(1000); formatter.DistanceUnitString.Should().Be("m"); formatter.ExportDateTimeFormatString.Should().Be("yyyy/MMM/dd HH:mm:ss.fff"); }
public void FormatterInitialization (string dateSeparator, string timeSeparator, string decimalSeparator, string thousandsSeparator, UnitsTypeEnum units, OutputTypes outputType, bool isRawDataAsDBaseRequired, string expectedNullString, double expectedDistanceConversionFactor, string expectedSpeedUnitString, double expectedSpeedConversionFactor, string expectedDistanceUnitString, string expectedExportDateTimeFormatString ) { var userPreference = new UserPreferences() // veta should ignore separators { DateSeparator = dateSeparator, TimeSeparator = timeSeparator, DecimalSeparator = decimalSeparator, ThousandsSeparator = thousandsSeparator, Units = (int)units }; var csvUserPreference = AutoMapperUtility.Automapper.Map <CSVExportUserPreferences>(userPreference); var formatter = new CSVExportFormatter(csvUserPreference, outputType, isRawDataAsDBaseRequired); formatter.UserPreference.DateSeparator.Should().Be(dateSeparator); formatter.UserPreference.TimeSeparator.Should().Be(timeSeparator); formatter.UserPreference.DecimalSeparator.Should().Be(decimalSeparator); formatter.UserPreference.ThousandsSeparator.Should().Be(thousandsSeparator); formatter.OutputType.Should().Be(outputType); formatter.IsRawDataAsDBaseRequired.Should().Be(isRawDataAsDBaseRequired); // this depends on isRawDataAsDBaseRequired formatter.NullString.Should().Be(expectedNullString); formatter.UserPreference.Units.Should().Be(units); formatter.DistanceConversionFactor.Should().Be(expectedDistanceConversionFactor); formatter.SpeedUnitString.Should().Be(expectedSpeedUnitString); formatter.SpeedConversionFactor.Should().Be(expectedSpeedConversionFactor); formatter.DistanceUnitString.Should().Be(expectedDistanceUnitString); formatter.ExportDateTimeFormatString.Should().Be(expectedExportDateTimeFormatString); }