public void ConvertTo_WithValidValues(int value, NumberSystem numberSystem, string expectedResult) { // arrange // act var result = NumberConversionStrategy.ConvertTo(value, numberSystem); // assert Assert.Equal(expectedResult, result); }
public void Convert() { try { ErrorMessage = null; if (string.IsNullOrEmpty(EntryValue)) { throw new FormatException(); } var valueAsInt = NumberConversionStrategy.ConvertFrom(EntryValue, EntryNumberSystem); ResultValue = NumberConversionStrategy.ConvertTo(valueAsInt, ResultNumberSystem); } catch { ErrorMessage = NumberConversionStrategy.GetNumberSystemErrorMessage(EntryNumberSystem); } }