public async Task Test_ForExistingCustomer_ShouldUpdateEmail()
        {
            // Arrange
            var mock     = new Mock <ICustomerRepository>();
            var customer = Fixture.Create <Customer>();

            mock.Setup(foo => foo.GetById(customer.Id)).Returns(customer);
            var email          = Fixture.Create <Email>();
            var command        = new UpdateCustomerEmailCommand(customer.Id, email);
            var commandHandler = new UpdateCustomerEmailCommandHandler(mock.Object);

            //  Act
            await commandHandler.Handle(command, CancellationToken.None);

            // Assert
            mock.Verify(repo => repo.GetById(customer.Id));
            mock.Verify(repo => repo.Save(customer));
        }
        public async Task Test_ForNonExistingCustomer_ShouldThrow()
        {
            var mock = new Mock <ICustomerRepository>();

            mock.Setup(foo => foo.GetById(1)).Returns((Customer)null);
            var email          = Fixture.Create <Email>();
            var command        = new UpdateCustomerEmailCommand(1, email);
            var commandHandler = new UpdateCustomerEmailCommandHandler(mock.Object);

            //  Assert
            var ex = await Assert.ThrowsAsync <ApplicationException>(async() => await commandHandler.Handle(command, CancellationToken.None));

            Assert.Contains("Customer not found", ex.Message);
            mock.Verify(repo => repo.GetById(1));
            mock.VerifyNoOtherCalls();
        }