public void ExpectToCallGetAllProductsOnAppropriateEventReceived() { IProductView view = Substitute.For <IProductView>(); IProductDataAccess dataAccess = Substitute.For <IProductDataAccess>(); ProductPresenter presenter = new ProductPresenter(view, dataAccess); view.ViewLoad += Raise.EventWith(view, new EventArgs()); dataAccess.Received().GetAllProducts(); }
public void ExpectToCallDeleteProductOnAppropriateEventReceived() { IProductView view = Substitute.For <IProductView>(); IProductDataAccess dataAccess = Substitute.For <IProductDataAccess>(); ProductPresenter presenter = new ProductPresenter(view, dataAccess); view.DeleteProduct += Raise.Event <EventHandler <int> >(view, 2); dataAccess.Received().DeleteProduct(2); }
public void ExpectToCallEditProductOnAppropriateEventReceived() { IProductView view = Substitute.For <IProductView>(); IProductDataAccess dataAccess = Substitute.For <IProductDataAccess>(); ProductPresenter presenter = new ProductPresenter(view, dataAccess); ProductViewModel viewModel = new ProductViewModel() { NameText = "Test", PriceText = "2" }; view.ModifyProduct += Raise.Event <EventHandler <ProductViewModel> >(view, viewModel); dataAccess.Received().EditProduct(Arg.Any <int>(), Arg.Is <Product>(x => x.Price == 2 && x.Name == "Test")); }