public void Run(string[] args) { Console.Write("Enter delimited numbers to be added: "); var input = Console.ReadLine(); Console.WriteLine(_calculationProvider.Calculate(input, CalculationType.AddWithEquation)); }
public void should_support_scenario_one() { Assert.Equal("21", _calculationProvider.Calculate("1,20")); }
public void should_support_new_line_as_alt_delimeter() { Assert.Equal("6", _calculationProvider.Calculate(@"1\n2,3")); }
public void should_support_more_than_two_number() { Assert.Equal("15", _calculationProvider.Calculate("1,2,3,4,5")); }
public void should_ignore_numbers_greater_than_1000() { Assert.Equal("8", _calculationProvider.Calculate("2,1001,6")); }
public void should_return_equation() { Assert.Equal("2+4+0+0+6 = 12", _calculationProvider.Calculate(@"2,4,rrrr,1001,6", CalculationType.AddWithEquation)); }
public void should_multiply_results() { Assert.Equal("32", _calculationProvider.Calculate(@"8,4,1", CalculationType.Multiply)); }
public void should_be_able_to_handle_multiple_custom_delimeters() { Assert.Equal("110", _calculationProvider.Calculate(@"//[*][!!][rrr]\n11rrr22*33!!44")); }
public void should_support_custom_delimeters() { Assert.Equal("7", _calculationProvider.Calculate("//;\n2;5")); }
public void should_support_custom_delimiter_of_any_length() { Assert.Equal("66", _calculationProvider.Calculate(@"//[***]\n11***22***33")); }
public void should_throw_exception_on_negative_numbers() { Assert.Throws <InvalidOperationException>(() => _calculationProvider.Calculate("1,-2,3")); }