public int Calculate(char sign, int firstNumber, int secondNumber) { if (sign == '+') { return(additionService.Add(firstNumber, secondNumber)); } else if (sign == '*') { return(multiplicationService.Multiply(firstNumber, secondNumber)); } throw new ArgumentException("Calculation Method Not Implemented"); }
public void GivenAMultiplicationLine_WithTwoTimesTwo_ExpectResultOfFour() { //Arrange var firstnum = 2; var secondnum = 2; //Act var result = _calculatorService.Calculate('*', firstnum, secondnum); //Assert A.CallTo(() => fakeMultiplicationService.Multiply(A <int> .Ignored, A <int> .Ignored)).MustHaveHappened(); }
public Output ProcessInput(Input input) { if (String.IsNullOrEmpty(input.AssertPresence)) { throw new ArgumentException("input.AssertPresence might not be null or Empty."); } if (input.DontBeNull == null) { throw new ArgumentException("input.DontBeNull has to be set."); } var result = new Output { Sum = _additionService.Add(input.Operands), Product = _multiplicationService.Multiply(input.Operands) }; return(result); }