public void Add_SomeValidValues_SumOfValues(int[] input, int expected) { // Arrange var sut = new ArrayCalculator(); // Act var actual = sut.Add(input); // Assert Assert.Equal(expected, actual); }
public void Add_WithNullParameter_ThrowsArgumentNullException() { // Arrange var sut = new ArrayCalculator(); // Act var ex = Record.Exception(() => sut.Add(null)); // Assert Assert.NotNull(ex); Assert.IsType <ArgumentNullException>(ex); }
public void Add_WithMaxIntPlus1_ThrowsOverflowException() { // Arrange var sut = new ArrayCalculator(); int[] input = { int.MaxValue, 1 }; // Act Action act = () => sut.Add(input); // Assert Assert.Throws <OverflowException>(() => act()); }