Exemple #1
0
        public void Test_SyncBookOrders_3_Orders_Only_2_book_order()
        {
            // hard to isolate dependency to unit test

            //var target = new OrderService();
            //target.SyncBookOrders();
            var target = new OrderServiceForTest();

            target.SetOrder(new List <Order>()
            {
                new Order()
                {
                    Type = "Book"
                },
                new Order()
                {
                    Type = "CD"
                },
                new Order()
                {
                    Type = "Book"
                },
            });
            var mockBookDao = Substitute.For <IBookDao>();

            target.SetBookDao(mockBookDao);
            target.SyncBookOrders();
            //mockBookDao.ReceivedWithAnyArgs(2).Insert(new Order());
            mockBookDao.Received(2).Insert(Arg.Is <Order>(o => o.Type == "Book"));
            //target
        }
        public void Test_SyncBookOrders_3_Orders_Only_2_book_order()
        {
            GivenOrders(
                CreateOrder("Book"),
                CreateOrder("CD"),
                CreateOrder("Book")
                );

            _orderServiceForTest.SetBookDao(_mockBookDao);

            _orderServiceForTest.SyncBookOrders();

            BookDaoShouldInsertTimes(2);
        }
Exemple #3
0
        public void Test_SyncBookOrders_3_Orders_Only_2_book_order()
        {
            GivenOrders(
                new Order {
                Type = "Book"
            },
                new Order {
                Type = "CD"
            },
                new Order {
                Type = "Book"
            }
                );

            _orderServiceForTest.SyncBookOrders();

            BookDaoShouldInsertTimes(2);
        }