コード例 #1
0
        public async Task ReturnsNWSOffice()
        {
            var content = fac.Get("weatherdata.json");

            FactoryMock.Setup(f => f.CreateClient(It.IsAny <string>()))
            .Returns(GetHttpClient(content));

            var stuff = await repository.GetNWSOfficeAsync("41.782", "-80.858");

            stuff.Should().NotBeNull().And
            .BeOfType(typeof(NWSLocation));
        }
コード例 #2
0
        public async Task ReturnsArrayOfNWSStations()
        {
            var content = fac.Get("stations.json");

            FactoryMock.Setup(f => f.CreateClient(It.IsAny <string>()))
            .Returns(GetHttpClient(content));

            var stuff = await repository.GetOfficeStations("ILN", "88", "76");

            stuff.Should().NotBeNull()
            .And.HaveCount(c => c > 0);
        }
コード例 #3
0
ファイル: HostBaseUnitTest.cs プロジェクト: SinaC/TetriNET
        private IHost CreateHost()
        {
            IFactory factory = new FactoryMock();
            IHost    host    = new HostBaseMock(factory.CreatePlayerManager(6), factory.CreateSpectatorManager(10), factory.CreateBanManager(), factory);

            host.SetVersion(new Versioning
            {
                Major = 1,
                Minor = 0
            });
            return(host);
        }
コード例 #4
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);
        }
コード例 #5
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);
        }