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 Setup() { _orderServiceForTest = new OrderServiceForTest(); _mockBookDao = Substitute.For <IBookDao>(); }