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); }
public void Setup() { _orderServiceForTest.SetBookDao(_mockBookDao); }