public async Task return_expected_result() { //Arrange var product = new Product(_guid, "", "", 1, _guid); var command = new AddProduct(_guid, "", "", 1, _guid); _productRepository.Setup(r => r.AddAsync(product)).Returns(Task.CompletedTask); //Act var handler = new AddProductHandler(_busPublisher.Object, _productRepository.Object, _logger.Object); await handler.HandleAsync(command, _context.Object); //Assert _productRepository.Verify(); _busPublisher.Verify(); }
public ManageProductsForm( ServerModel model, AddProductHandler addProductHandler, RemoveProductHandler removeProductHandler, ModifyProductHandler modifyProductHandler, StartProductAuctionHandler startProductAuctionHandler, StopProductAuctionHandler stopProductAuctionHandler, ProductsFormClosedHandler productsFormClosedHandler ) { this.itsModel = model; this.itsState = ServerState.MONITORING_STATE; this.updateObserver = this.update; this.addProductHandler = addProductHandler; this.removeProductHandler = removeProductHandler; this.modifyProductHandler = modifyProductHandler; this.startProductAuctionHandler = startProductAuctionHandler; this.stopProductAuctionHandler = stopProductAuctionHandler; this.productsFormClosedHandler = productsFormClosedHandler; InitializeComponent(); this.render(itsState); }
public AddProductHandlerTests() { _productsRepository = Substitute.For <IProductsRepository>(); _handler = new AddProductHandler(_productsRepository); }