Beispiel #1
0
 internal int Run(int?number)
 {
     try {
         Console.WriteLine(
             numeralConverter.ToNumeral(
                 number ?? Int32.Parse(Console.In.ReadToEnd())
                 )
             );
         return(0);
     } catch (ArgumentException) {
         Console.Error.WriteLine($"Could not format number {number} to numeral. "
                                 + "See --help for details on which numbers can be formatted.");
         return(1);
     } catch (FormatException) {
         Console.Error.WriteLine("Could not parse input. Please only enter integral numbers. "
                                 + "See --help for details on which numbers can be formatted.");
         return(1);
     }
 }
 public void ToNumeral_UsesAdditiveNotationForSmallValues(int value, string expected)
 {
     converter.ToNumeral(value)
     .Should().Be(expected, "small values (< 3) are represented as repetitions of I");
 }