Esempio n. 1
0
        public void GetNumberSystemErrorMessage(NumberSystem numberSystem)
        {
            // arrange

            // act
            var result = NumberConversionStrategy.GetNumberSystemErrorMessage(numberSystem);

            // assert
            Assert.Contains(numberSystem.ToString(), result);
        }
Esempio n. 2
0
        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);
            }
        }