コード例 #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);
        }