public void NoStateOrApartmentToStringTest() { var target = new StreetAddress(";1894;beacon st;brookline;;usa;02445"); const string expected = "1894 beacon st\n" + "brookline USA\n02445"; Assert.AreEqual(expected, target.ToString()); }
public void ApartmentAndStateToStringTest() { var target = new StreetAddress("1;1894;beacon st;brookline;ma;usa;02445"); const string expected = "1894 beacon st\tApartment #1\n" + "brookline MA USA\n02445"; Assert.AreEqual(expected, target.ToString()); }
public string ToString(char separator) { return($"{StreetAddress?.ToString()}{separator}{OtherDesignation}{separator}{City}" + $"{separator}{StateOrProvince}{separator}{ZipOrPostalCode}" + $"{separator}{Country?.BestValue}{separator}{AddressType?.BestValue}{separator}{OtherGeographicDesignation}" + $"{separator}{CountyOrParishCode?.BestValue}{separator}{CensusTract?.BestValue}{separator}" + $"{AddressRepresentationCode?.BestValue}{separator}{AddressValidityRange?.ToString()}" .TrimEnd(separator)); }
public override string ToString() { var parts = new List <string>(); if (Addressee != null && !string.IsNullOrWhiteSpace(Addressee.ToString())) { parts.Add(Addressee.ToString()); } if (StreetAddress != null && !string.IsNullOrWhiteSpace(StreetAddress.ToString())) { parts.Add(StreetAddress.ToString()); } if (Locality != null && !string.IsNullOrWhiteSpace(Locality.ToString())) { parts.Add(Locality.ToString()); } if (AdministrativeRegion != null && !string.IsNullOrWhiteSpace(AdministrativeRegion.ToString())) { parts.Add(AdministrativeRegion.ToString()); } if (PostalCode != null && !string.IsNullOrWhiteSpace(PostalCode.ToString())) { parts.Add(PostalCode.ToString()); } if (Country != null && !string.IsNullOrWhiteSpace(Country.ToString())) { parts.Add(Country.ToString()); } return(string.Join(", ", parts)); }