public void ShouldNot_ThrowException_WhenDoingDevideByZero() { //arrange var clientMock = new Mock<IOutputService>(); var calculator = new CalculatorEngine(clientMock.Object); calculator.FirstArg = 2; calculator.SecondArg = 0; //act calculator.Devide(); //assert Assert.Pass(); }
public void Should_ExecutePrintResultMethodWithArgument6OfOutputService_WhenDoing12Devide2() { //arrange var clientMock = new Mock<IOutputService>(); var calculator = new CalculatorEngine(clientMock.Object); calculator.FirstArg = 12; calculator.SecondArg = 2; string expected = "6,00000"; //act calculator.Devide(); //Assert clientMock.Verify(x => x.PrintData(expected), Times.Exactly(1)); }
public void Should_ReturnDevideBy0InResult_WhenDoingDevide3By0() { //arrange var clientMock = new Mock<IOutputService>(); var calculator = new CalculatorEngine(clientMock.Object); calculator.FirstArg = 3; calculator.SecondArg = 0; //act calculator.Devide(); //assert Assert.AreEqual(calculator.Result,"Devide by 0"); }
public void Should_Return2_WhenDoing2Devide1() { //arrange var clientMock = new Mock<IOutputService>(); var calculator = new CalculatorEngine(clientMock.Object); calculator.FirstArg = 2; calculator.SecondArg = 1; string expected = "2,00000"; //act calculator.Devide(); //asssert Assert.AreEqual(calculator.Result, expected); }