public async Task Quote_has_been_created_for_costumer() { var currency = Currency.USDollar; var productPrice = 12.5; var productQuantity = 10; var customerEmail = "*****@*****.**"; var customerUniquenessChecker = Substitute.For <ICustomerUniquenessChecker>(); customerUniquenessChecker.IsUserUnique(customerEmail).Returns(true); var productMoney = Money.Of(Convert.ToDecimal(productPrice), currency.Code); var customer = await Customer .CreateNew(customerEmail, "Customer X", customerUniquenessChecker); _customers .GetById(Arg.Any <CustomerId>()).Returns(customer); var product = Product.CreateNew("Product X", productMoney); _products.GetById(Arg.Any <ProductId>()).Returns(product); var handler = new CreateQuoteCommandHandler(_unitOfWork); var command = new CreateQuoteCommand(customer.Id.Value, new ProductDto(product.Id.Value, productQuantity)); var result = await handler.Handle(command, CancellationToken.None); await _quotes.Received(1) .Add(Arg.Is((Quote c) => c.Id.Value == result.Id), Arg.Any <CancellationToken>()); await _customers.Received(1) .GetById(customer.Id, Arg.Any <CancellationToken>()); await _unitOfWork.Received(1) .CommitAsync(Arg.Any <CancellationToken>()); result.Should().NotBe(Guid.Empty); }