public void TestConstructor_PassEverythingCorrectly_ShouldInitializeCorrectly() { var mockedView = new Mock <IAddToCartView>(); var mockedCart = new Mock <IShoppingCart>(); var presenter = new AddToCartPresenter(mockedView.Object, mockedCart.Object); Assert.IsNotNull(presenter); }
public CartController(IGetCartUseCase getCartUseCase, GetCartPresenter getCartPresenter, IAddToCartUseCase addToCartUseCase, AddToCartPresenter addToCartPresenter, IRemoveFromCartUseCase removeFromCartUseCase, RemoveFromCartPresenter removeFromCartPresenter) { _getCartUseCase = getCartUseCase; _getCartPresenter = getCartPresenter; _addToCartUseCase = addToCartUseCase; _addToCartPresenter = addToCartPresenter; _removeFromCartUseCase = removeFromCartUseCase; _removeFromCartPresenter = removeFromCartPresenter; }
public void TestViewMyAddToCart_ShouldCallCartItemAddToCartCorrectly(int productId, int quantity) { var mockedView = new Mock <IAddToCartView>(); var mockedCart = new Mock <IShoppingCart>(); var presenter = new AddToCartPresenter(mockedView.Object, mockedCart.Object); var args = new AddToCartEventArgs(productId, quantity); mockedView.Raise(v => v.MyAddToCart += null, args); mockedCart.Verify(c => c.AddItem(productId, quantity), Times.Once); }