Пример #1
0
        public Address CreateAddress(AddressViewRow addressViewRow)
        {
            if (addressViewRow == null)
            {
                throw new ArgumentNullException("addressViewRow");
            }

            return(new Address(addressViewRow.AddressId)
            {
                StreetAddressLine1 = addressViewRow.Address1,
                StreetAddressLine2 = addressViewRow.Address2,
                City = addressViewRow.City,
                CityId = addressViewRow.CityId,
                Country = addressViewRow.Country,
                CountryId = addressViewRow.CountryId,
                State = addressViewRow.State,
                StateCode = addressViewRow.StateCode,
                StateId = addressViewRow.StateId,
                ZipCode =
                    addressViewRow.ZipId != 0 && !string.IsNullOrEmpty(addressViewRow.ZipCode)
                                   ? new ZipCode(addressViewRow.ZipId)
                {
                    Zip = addressViewRow.ZipCode,
                    Latitude = !string.IsNullOrEmpty(addressViewRow.ZipLatitiude) ? Convert.ToSingle(addressViewRow.ZipLatitiude.Trim()) : 0,
                    Longitude = !string.IsNullOrEmpty(addressViewRow.ZipLongitude) ? Convert.ToSingle(addressViewRow.ZipLongitude.Trim()) : 0
                } : null,
                Latitude =
                    !string.IsNullOrEmpty(addressViewRow.Latitude) ? addressViewRow.Latitude : string.Empty,
                Longitude =
                    !string.IsNullOrEmpty(addressViewRow.Longitude) ? addressViewRow.Longitude : string.Empty,
                LatLogUseForAddressMaping = addressViewRow.UseLatLogForMapping,
                VerificationOrgRoleUserId = addressViewRow.VerificationOrgRoleUserId < 1 ? null : (long?)addressViewRow.VerificationOrgRoleUserId
            });
        }
Пример #2
0
        public void CreateMedicalVendorMapsAddressPropertiesCorrectly()
        {
            AddressViewRow addressViewRow = GetValidAddressViewRow("StreetAddress1", "City", "Country");

            Address address = _addressFactory.CreateAddress(addressViewRow);

            Assert.AreEqual(addressViewRow.Address1, address.StreetAddressLine1);
            Assert.AreEqual(addressViewRow.City, address.City);
            Assert.AreEqual(addressViewRow.Country, address.Country);
        }