コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 public FactoryMock(CallChecker callChecker, int inventory = 0)
 {
     this.callChecker = callChecker;
     this.inventory   = inventory;
 }
コード例 #4
0
 public SellerMock(CallChecker isCalled, int inventory = 0)
 {
     this.isCalled  = isCalled;
     this.inventory = inventory;
 }