public async Task When_Adding_Order_Then_Gets_Address_From_Service() { // Act await Sut.Handle(Request, default); // Assert AddressQueryServiceMock.Verify(x => x.GetAsync(Request.Address, Request.AddressId, Request.UserId)); }
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)); }