public void ShouldCheckoutIsFailedAddressInvalid() { var order = GeneratedObjectsTests.GenerateOrder(3); var address = GeneratedObjectsTests.GenerateAddress(); var card = GeneratedObjectsTests.GenerateCreditCard("1234-5678-9012-3456"); order.Checkout(address.ContactName, address.Street, address.City, string.Empty, card.Number); var result = order.Valid; result.Should().BeFalse(); order.Notifications.FirstOrDefault()?.Message.Should().Be("Country is required."); }
public void OrderItemShouldBeAllRemovedInOrder() { //Arrange var handler = Fixture.GetOrderHandler(); var command = GeneratedObjectsTests.GenerateRemoveAllCommand(); var order = GeneratedObjectsTests.GenerateOrder(); Fixture.OrderAdoRepositoryMock.Setup(r => r.GetLastCreatedOrderById(command.OrderId)) .Returns(order); //Act var result = handler.Handle(command); //Assert Fixture.OrderAdoRepositoryMock.Verify(r => r.GetLastCreatedOrderById(command.OrderId), Times.Once); Fixture.OrderItemAdoRepositoryMock.Verify(r => r.DeleteAllbyOrderId(command.OrderId), Times.Once); result.Should().BeOfType <ReturnedItemCommandResult>(); }