Example #1
0
        public void ProviderDomain_SetProprietiesForProviderWithContactsAndAddress_ShouldSetAsCorrectValueOnProperties()
        {
            //Arrange
            var providerExpected = _providerTestFixture.GenerateProviderExpected();
            var addressExpected  = new AddressTestFixture().GenerateAddressExpected();

            //Act
            var provider = new Provider(providerExpected.Id,
                                        providerExpected.Name,
                                        providerExpected.Document);
            var address = new Address(addressExpected.Id,
                                      addressExpected.ZipCode,
                                      addressExpected.Street,
                                      addressExpected.Number,
                                      addressExpected.Complement,
                                      addressExpected.District);

            address.SetCity(addressExpected.CityId);
            provider.AddAddress(address);

            //Assert
            provider.Should().NotBeNull();
            provider.Id.Should().Be(providerExpected.Id);
            provider.Name.Should().Be(providerExpected.Name);
            provider.Document.Should().Be(providerExpected.Document);

            foreach (var itemAddress in provider.Addresses)
            {
                itemAddress.Id.Should().Be(addressExpected.Id);
                itemAddress.ZipCode.Should().Be(addressExpected.ZipCode);
                itemAddress.Street.Should().Be(addressExpected.Street);
                itemAddress.Number.Should().Be(addressExpected.Number);
                itemAddress.Complement.Should().Be(addressExpected.Complement);
                itemAddress.District.Should().Be(addressExpected.District);
                itemAddress.CityId.Should().Be(addressExpected.CityId);
            }
        }