public void UnitTest01_storeGoodsGreaterThan500WillTriggerSellAction() { //Arrange CallChecker isCalledSell = new CallChecker(); CallChecker isCalledProduce = new CallChecker(); iStoreManagement sellerMock = new SellerMock(isCalledSell, 501); iFactoryManagement factoryMock = new FactoryMock(isCalledProduce); Business testObject = new Business(factoryMock, sellerMock); //Act testObject.runningBusiness(); //Assert Assert.IsTrue(isCalledSell.isCalled); }
public void UnitTest02_storeGoodsLessThan500WillProduceSixTimes() { //Arrange CallChecker isCalledFetchProduct = new CallChecker(); CallChecker isCalledProduce = new CallChecker(); iStoreManagement sellerMock = new SellerMock(isCalledFetchProduct); iFactoryManagement factoryMock = new FactoryMock(isCalledProduce); Business testObject = new Business(factoryMock, sellerMock); //Act testObject.runningBusiness(); //Assert Assert.IsTrue(isCalledFetchProduct.isCalled); Assert.AreEqual(6, ((FactoryMock)factoryMock).produceTime); }
public FactoryMock(CallChecker callChecker, int inventory = 0) { this.callChecker = callChecker; this.inventory = inventory; }
public SellerMock(CallChecker isCalled, int inventory = 0) { this.isCalled = isCalled; this.inventory = inventory; }