Esempio n. 1
0
        public void TestShippingByStore_Seven_1_Order_Family_2_Orders()
        {
            //arrange
            var target = new ShipService();

            var orders = new List <Order>
            {
                new Order {
                    StoreType = StoreType.Seven, Id = 1
                },
                new Order {
                    StoreType = StoreType.Family, Id = 2
                },
                new Order {
                    StoreType = StoreType.Family, Id = 3
                },
            };

            var fakeSeven = Substitute.For <IStoreService>();

            SimpleFactory.SevenService = fakeSeven;
            var fakeFamily = Substitute.For <IStoreService>();

            SimpleFactory.FamilyService = fakeFamily;

            //act
            target.ShippingByStore(orders);

            //todo, assert
            //ShipService should invoke SevenService once and FamilyService twice
            fakeFamily.ReceivedWithAnyArgs(2);
            fakeSeven.ReceivedWithAnyArgs(1);
        }
Esempio n. 2
0
        public void TestShippingByStore_Seven_1_Order_Family_2_Orders()
        {
            //arrange
            var target = new ShipService();

            var orders = new List <Order>
            {
                new Order {
                    StoreType = StoreType.Seven, Id = 1
                },
                new Order {
                    StoreType = StoreType.Family, Id = 2
                },
                new Order {
                    StoreType = StoreType.Family, Id = 3
                },
            };

            IStoreService sevenService  = Substitute.For <IStoreService>();
            IStoreService familyService = Substitute.For <IStoreService>();

            //var simpleFactory = new MockSimpleFactory
            //{
            //	SevenService = sevenService,
            //	FamilyService = familyService
            //};
            SimpleFactory.SetSevenService(sevenService);
            SimpleFactory.SetFamilyService(familyService);

            //act
            target.ShippingByStore(orders);

            //todo, assert
            //ShipService should invoke SevenService once and FamilyService twice
            sevenService.Received(1).Ship(Arg.Is <Order>(x => x.StoreType == StoreType.Seven));
            familyService.Received(2).Ship(Arg.Is <Order>(x => x.StoreType == StoreType.Family));
        }
Esempio n. 3
0
        public void TestShippingByStore_Seven_1_Order_Family_2_Orders()
        {
            //arrange
            var target = new ShipService();

            var orders = new List <Order>
            {
                new Order {
                    StoreType = StoreType.Seven, Id = 1
                },
                new Order {
                    StoreType = StoreType.Family, Id = 2
                },
                new Order {
                    StoreType = StoreType.Family, Id = 3
                },
            };

            //act
            target.ShippingByStore(orders);

            //todo, assert
            //ShipService should invoke SevenService once and FamilyService twice
        }