コード例 #1
0
        public void AddProductShouldAddProductToOrder()
        {
            // Given
            A.CallTo(() => _addProductToOrderCommand.Run(Constants.IphoneCaseOrder.Id, Constants.IphoneCase.Id))
            .DoesNothing();

            // When
            _ordersController.AddProduct(Constants.IphoneCaseOrder.Id, new ProductWrapper(Constants.IphoneCase.Id));

            // Then
            A.CallTo(() => _addProductToOrderCommand.Run(Constants.IphoneCaseOrder.Id, Constants.IphoneCase.Id))
            .MustHaveHappened();
        }
コード例 #2
0
        public void RunShouldAddProductsFromBundleToOrder()
        {
            var expectedProducts = new[] { Constants.IphoneCase };

            // Given
            A.CallTo(() => _dapperService.List <Product>(A <string> .Ignored, A <object> .Ignored))
            .Returns(expectedProducts);

            A.CallTo(() => _addProductToOrderCommand.Run(Constants.IphoneCaseOrder.Id, Constants.IphoneCase.Id))
            .DoesNothing();

            // When
            _addBundleToOrderCommand.Run(Constants.IphoneCaseOrder.Id, Constants.IphoneBundle.Id);

            // Then
            A.CallTo(() => _dapperService.List <Product>(A <string> .Ignored, A <object> .Ignored))
            .MustHaveHappened();

            A.CallTo(() => _addProductToOrderCommand.Run(Constants.IphoneCaseOrder.Id, Constants.IphoneCase.Id))
            .MustHaveHappened();
        }
        public void RunShouldReturnAggregatedBundlesForProduct()
        {
            // Given
            A.CallTo(() => _dapperService.Execute(A <string> .Ignored, A <object> .Ignored))
            .DoesNothing();

            // When
            _addProductToOrderCommand.Run(Constants.IphoneCaseOrder.Id, Constants.IphoneCase.Id);

            // Then

            A.CallTo(() => _dapperService.Execute(A <string> .Ignored, A <object> .Ignored))
            .MustHaveHappened();
        }
コード例 #4
0
 public void AddProduct(Guid id, [FromBody]  ProductWrapper product)
 {
     _addProductToOrderCommand.Run(id, product.ProductId);
 }