public void TestValidate_AddressAlreadyExists_ValidationError(
            [Frozen] Mock <IRepository <Entities.Customer> > customerRepoMock,
            Entities.StoreCustomer customer,
            UpdateCustomerAddressCommandValidator sut,
            UpdateCustomerAddressCommand command,
            Entities.CustomerAddress customerAddress
            )
        {
            //Arrange
            customer.AddAddress(customerAddress);

            command.AccountNumber = "1";
            var address = customer.Addresses.ToList()[0];

            command.CustomerAddress.AddressType               = address.AddressType;
            command.CustomerAddress.Address.AddressLine1      = address.Address.AddressLine1;
            command.CustomerAddress.Address.AddressLine2      = address.Address.AddressLine2;
            command.CustomerAddress.Address.PostalCode        = address.Address.PostalCode;
            command.CustomerAddress.Address.City              = address.Address.City;
            command.CustomerAddress.Address.StateProvinceCode = address.Address.StateProvinceCode;
            command.CustomerAddress.Address.CountryRegionCode = address.Address.CountryRegionCode;

            customerRepoMock.Setup(x => x.GetBySpecAsync(
                                       It.IsAny <GetCustomerSpecification>(),
                                       It.IsAny <CancellationToken>()
                                       ))
            .ReturnsAsync(customer);

            //Act
            var result = sut.TestValidate(command);

            //Assert
            result.ShouldHaveValidationErrorFor(command => command)
            .WithErrorMessage("Address must be unique");
        }
            public async Task GetPreferredShippingAddress_HomeAddressExists_ReturnAddress(
                [Frozen] Mock <IRepository <Entities.Customer> > customerRepoMock,
                GetPreferredAddressQueryHandler sut,
                GetPreferredAddressQuery query,
                Entities.StoreCustomer customer,
                Entities.Address address
                )
            {
                //Arrange
                query.AddressType = "Shipping";
                customer.AddAddress(
                    new Entities.CustomerAddress(
                        "Home",
                        address
                        )
                    );

                customerRepoMock.Setup(_ => _.GetBySpecAsync(
                                           It.IsAny <GetCustomerAddressesSpecification>(),
                                           It.IsAny <CancellationToken>()
                                           ))
                .ReturnsAsync(customer);

                //Act
                var result = await sut.Handle(query, CancellationToken.None);

                //Assert
                result.Should().BeEquivalentTo(
                    address,
                    opt => opt.Excluding(_ => _.SelectedMemberPath.EndsWith("Id", StringComparison.InvariantCultureIgnoreCase))
                    );

                customerRepoMock.Verify(x => x.GetBySpecAsync(
                                            It.IsAny <GetCustomerAddressesSpecification>(),
                                            It.IsAny <CancellationToken>()
                                            ));
            }