public void Defaults() { var methods = new MethodExamples(); Assert.Equal(4, methods.Add(2, 2)); Assert.Equal(20, methods.Add(10)); Assert.Equal(12, methods.Add()); }
public void UsingTheParams() { var methods = new MethodExamples(); var total = methods.Add(1, 2, 3, 4, 5, 6, 7, 8, 9); Assert.Equal(45, total); }
public void UsingTheParams() { var methods = new MethodExamples(); //1 becomes a, 2 becomes b, everything else is thrown into rest[] var total = methods.Add(1, 2, 3, 4, 5, 6, 7, 8, 9); Assert.Equal(45, total); }
public void UsingTheParams() { var methods = new MethodExamples(); // 1, 2 are a, b // 3,4,5,6,7,8,9 are in the int[] rest var total = methods.Add(1, 2, 3, 4, 5, 6, 7, 8, 9); Assert.Equal(45, total); }