コード例 #1
0
        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();
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 public AddProductHandlerTests()
 {
     _productsRepository = Substitute.For <IProductsRepository>();
     _handler            = new AddProductHandler(_productsRepository);
 }