Example #1
0
 public AddOrderCommandHandlerTests()
 {
     OrderCommandServiceMock
     .Setup(x => x.CreateOrderAsync(It.IsAny <User>(), It.IsAny <IList <ProductOrder> >(), It.IsAny <Shipment>(), It.IsAny <Payment>(),
                                    It.IsAny <OrderDiscount>(), It.IsAny <string>(), It.IsAny <Address>()))
     .ReturnsAsync(Order);
 }
Example #2
0
        public async Task When_Adding_Order_Then_Adds_With_Service(User user, IList <ProductOrder> productOrders, Shipment shipment, Payment payment, Address address)
        {
            // Arrange
            UserQueryServiceMock.Setup(x => x.GetRawByIdAsync(It.IsAny <Guid>())).ReturnsAsync(user);
            ProductOrderQueryServiceMock.Setup(x => x.CreateAsync(It.IsAny <IList <ProductWithCharmsOrderDto> >())).ReturnsAsync(productOrders);
            ShipmentQueryServiceMock.Setup(x => x.GetRawAsync(It.IsAny <Guid>())).ReturnsAsync(shipment);
            OrderDiscountQueryServiceMock.Setup(x => x.GetRawByCodeAsync(It.IsAny <string>())).ReturnsAsync(OrderDiscount);
            AddressQueryServiceMock.Setup(x => x.GetAsync(It.IsAny <NewAddressDto>(), It.IsAny <Guid?>(), It.IsAny <Guid>())).ReturnsAsync(address);

            // Act
            await Sut.Handle(Request, default);

            // Assert
            OrderCommandServiceMock.Verify(x => x.CreateOrderAsync(user, productOrders, shipment, payment, OrderDiscount, Request.Comment, address));
        }