public void SubtractThreeNumbers() { var displayMock = Substitute.For<Display>(); var sut = new RpnCalc(displayMock); sut.Pressed(3.0); sut.Enter(); sut.Pressed(2.0); sut.Subtract(); sut.Pressed(5.0); sut.Subtract(); displayMock.Received(2).Show(3.0); displayMock.Received(1).Show(2.0); displayMock.Received(1).Show(1.0); displayMock.Received(1).Show(5.0); displayMock.Received(1).Show(-4.0); }
public void SubtractingTwiceAfterEnterWasPressedWhileReachingStackBoundary() { var displayMock = Substitute.For<Display>(); var sut = new RpnCalc(displayMock); sut.Pressed(6.0); sut.Enter(); sut.Pressed(4.0); sut.Enter(); sut.Pressed(3.0); sut.Enter(); sut.Subtract(); sut.Subtract(); sut.Subtract(); sut.Subtract(); displayMock.Received(1).Show(0.0); displayMock.Received(4).Show(4.0); displayMock.Received(1).Show(2.0); }
public void SubtractOneNumberWithoutEnter() { var displayMock = Substitute.For<Display>(); var sut = new RpnCalc(displayMock); sut.Pressed(1.0); sut.Subtract(); displayMock.Received(1).Show(1.0); displayMock.Received(1).Show(-1.0); }
public void IntegrationTestAddingSubtractingAndMultiplying() { var displayMock = Substitute.For<Display>(); var sut = new RpnCalc(displayMock); sut.Pressed(1); sut.Enter(); sut.Pressed(2); sut.Add(); sut.Pressed(4); sut.Enter(); sut.Pressed(1); sut.Subtract(); sut.Multiply(); displayMock.Received(3).Show(1.0); displayMock.Received(1).Show(2.0); displayMock.Received(2).Show(3.0); displayMock.Received(2).Show(4.0); displayMock.Received(1).Show(9.0); }