Ejemplo n.º 1
0
        public void AddBundleShouldAddBundleProductsToOrder()
        {
            // Given
            A.CallTo(() => _addBundleToOrderCommand.Run(Constants.IphoneCaseOrder.Id, Constants.IphoneBundle.Id))
            .DoesNothing();

            // When
            _ordersController.AddBundle(Constants.IphoneCaseOrder.Id, new BundleWrapper(Constants.IphoneBundle.Id));

            // Then
            A.CallTo(() => _addBundleToOrderCommand.Run(Constants.IphoneCaseOrder.Id, Constants.IphoneBundle.Id))
            .MustHaveHappened();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 3
0
 public void AddBundle(Guid id, [FromBody]  BundleWrapper bundle)
 {
     _addBundleToOrderCommand.Run(id, bundle.BundleId);
 }