public void Convert_NegativeSimpleNumber_ThrowsArgumentException() { var adder = new Adder(); Expect(() => adder.Convert("-100"), Throws.ArgumentException); Expect(() => adder.Convert("100-"), Throws.ArgumentException); Expect(() => adder.Convert("100-"), Throws.ArgumentException); }
public void Convert_Null_ThrowsArgumentNullException() { var adder = new Adder(); Expect(() => adder.Convert(null), Throws.ArgumentNullException .With.Message.Contains("Empty") .And.Property("ParamName").Contains("amount")); }
public void Convert_CorrectComplexNumber_ConvertsItToDecimalOfSum() { var adder = new Adder(); var actual = adder.Convert("100 + 100"); Expect(actual, EqualTo(200m)); }
public void Convert_PositiveSimpleNumber_ConvertsItToDecimal() { var adder = new Adder(); var actual = adder.Convert("100"); Expect(actual, EqualTo(100m)); }
public void Convert_NegativeComplexNumber_ThrowsArgumentException() { var adder = new Adder(); Expect(() => adder.Convert("-100"), Throws.ArgumentException .With.Message.Contains("Negative") .And.Property("ParamName").Contains("sum")); Expect(() => adder.Convert("100-"), Throws.ArgumentException .With.Message.Contains("Negative") .And.Property("ParamName").Contains("sum")); Expect(() => adder.Convert("-100 + 20"), Throws.ArgumentException .With.Message.Contains("Negative") .And.Property("ParamName").Contains("sum")); Expect(() => adder.Convert("-100 + -20"), Throws.ArgumentException .With.Message.Contains("Negative") .And.Property("ParamName").Contains("sum")); }
public void Convert_IncorrectComplexNumber_ThrowsFormatException() { var adder = new Adder(); Expect(() => adder.Convert("100 + "), Throws.TypeOf <FormatException>()); Expect(() => adder.Convert("100+ "), Throws.TypeOf <FormatException>()); Expect(() => adder.Convert("100+"), Throws.TypeOf <FormatException>()); Expect(() => adder.Convert("-100-"), Throws.TypeOf <FormatException>()); Expect(() => adder.Convert("awd"), Throws.TypeOf <FormatException>()); Expect(() => adder.Convert("+@#$"), Throws.TypeOf <FormatException>()); }