public void EqualityIsDeterminedByContent() { sut = PostalCode.Create(ValidPostalCode); PostalCode other = PostalCode.Create(ValidPostalCode); Assert.AreEqual(other, sut); }
protected override int GetHashCodeCore() { return(CountryCode.GetHashCode() ^ Country.GetHashCode() ^ PostalCode.GetHashCode() ^ State.GetHashCode() ^ County.GetHashCode() ^ City.GetHashCode() ^ Suburb.GetHashCode() ^ StreetName.GetHashCode() ^ StreetNumber.GetHashCode() ^ PlaceName.GetHashCode()); }
public override bool Equals(object obj) { Address other = obj as Address; if (other == null) { return(false); } return(Name.Equals(other.Name, StringComparison.Ordinal) && City.Equals(other.City, StringComparison.Ordinal) && PostalCode.Equals(other.PostalCode, StringComparison.Ordinal) && PostalAbbreviation.Equals(other.PostalAbbreviation, StringComparison.Ordinal)); }
public void AddAddress(string street, PostalCode postalCode, string city, string country) { if (this.AcceptedCountries.All(x => x != country)) { throw new Exception($"{country} Not valid Country"); } this.Address = new Address(); this.Address.Street = street; this.Address.PostalCode = postalCode; this.Address.City = city; this.Address.Country = country; }
/// <summary> /// Return the HashCode of this object. /// </summary> /// <returns>The HashCode of this object.</returns> public override Int32 GetHashCode() { unchecked { return(Street.GetHashCode() * 17 ^ HouseNumber.GetHashCode() * 13 ^ FloorLevel.GetHashCode() * 11 ^ PostalCode.GetHashCode() * 7 ^ PostalCodeSub.GetHashCode() * 5 ^ City.GetHashCode() * 3 ^ Country.GetHashCode()); } }
public bool Equals(Address other) { if (other == null) { return(false); } return(AddressLine1.Equals(other.AddressLine1) && ((AddressLine2 == null && other.AddressLine2 == null) || (AddressLine2 != null && AddressLine2.Equals(other.AddressLine2))) && PostalCode.Equals(other.PostalCode) && City.Equals(other.City) && Country.Equals(other.Country)); }
public override int GetHashCode() { unchecked { var hashCode = (Street != null ? Street.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Street2 != null ? Street2.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (PostalCode != null ? PostalCode.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (City != null ? City.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Country != null ? Country.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (CareOf != null ? CareOf.GetHashCode() : 0); return(hashCode); } }
private void GetLocationCode(string zip) { var client = new RestClient("http://dataservice.accuweather.com/locations/v1/postalcodes/search?apikey=SyQbb4hIuNveRnj4NLzAWrRWBPMyv53q&q=" + zip); var request = new RestRequest(Method.GET); request.AddHeader("Postman-Token", "23acb8fb-c16a-4064-b29c-7d55d782675e"); request.AddHeader("Cache-Control", "no-cache"); IRestResponse response = client.Execute(request); PostalCode postalCode = new PostalCode(response.Content.ToString()); locationCode = postalCode.Key; }
public CheckOut EnterBillingDetails() { Email.SendKeys("*****@*****.**"); FirstName.SendKeys("Kalyan"); LastName.SendKeys("JVN"); Address.SendKeys("1001 Richmond Ave "); City.SendKeys("Houston"); Country.SendKeys("USA"); PostalCode.SendKeys("77042"); Phone.SendKeys("0123456789"); return(this); }
private PostalAddress CreatePostalAddress(string addressLine1, string addressLine2, string addressLine3, City city, PostalCode postalCode) => new PostalAddressBuilder(this.Session) .WithAddress1(addressLine1) .WithAddress2(addressLine2) .WithAddress3(addressLine3) .WithPostalAddressBoundary(postalCode) .WithPostalAddressBoundary(city) .WithPostalAddressBoundary(city.State.Country) .Build();
public override int GetHashCode() { // allow overflow unchecked { int hash = 17; hash = (hash * 23) + Name.GetHashCode(); hash = (hash * 23) + City.GetHashCode(); hash = (hash * 23) + PostalCode.GetHashCode(); hash = (hash * 23) + PostalAbbreviation.GetHashCode(); return(hash); } }
public RegisterAddress( AddressId addressId, StreetNameId streetNameId, PostalCode postalCode, HouseNumber houseNumber, BoxNumber boxNumber) { AddressId = addressId; StreetNameId = streetNameId; PostalCode = postalCode; HouseNumber = houseNumber; BoxNumber = boxNumber; }
public override void Save() { string SQL = qryEmployeeSave; try { if (!Owner.isCreated) { Owner = Program.UserContext; } SQL = SQL.Replace(":empid", Key.ToString()); SQL = SQL.Replace(":persontitle", "'" + Title.ToString() + "'"); SQL = SQL.Replace(":personname", "'" + Name.ToString() + "'"); SQL = SQL.Replace(":personmiddle", "'" + Middlename.ToString() + "'"); SQL = SQL.Replace(":personlastname", "'" + Surname.ToString() + "'"); SQL = SQL.Replace(":_phone", Phone.ToString() == "" ? "null" : "'" + Phone.ToString() + "'"); SQL = SQL.Replace(":city", "'" + City.ToString() + "'"); SQL = SQL.Replace(":country", "'" + Country.ToString() + "'"); SQL = SQL.Replace(":region", "'" + Region.ToString() + "'"); SQL = SQL.Replace(":district", "'" + District.ToString() + "'"); SQL = SQL.Replace(":_address", "'" + Address.ToString() + "'"); SQL = SQL.Replace(":postalcode", "'" + PostalCode.ToString() + "'"); SQL = SQL.Replace(":dateborn", "'" + Birthday.ToString() + "'"); SQL = SQL.Replace(":_email", "'" + Email.ToString() + "'"); SQL = SQL.Replace(":rcomment", "'" + RComment.ToString() + "'"); SQL = SQL.Replace(":ownerid", isCreated ? Owner.Key : Program.UserContext.Key); SQL = SQL.Replace(":locked", Locked ? "1" : "0"); SQL = SQL.Replace(":username", "'" + UserName.ToString() + "'"); SQL = SQL.Replace(":userpassword", "'" + Encryption.Encode(UserPassword.ToString(), Program.PasswordKey) + "'"); Client.ExecuteSQLCommit(SQL); Owner.Load(); MainForm.toolStripStatusOwner.Text = Owner.Title; isChanged = false; isCreated = true; Program.EmployeesAreChanged = true; Program.RefreshEmployee(this); } catch (Exception e) { MessageBox.Show(e.Message + "\n"); } }
public override bool Equals(object obj) { var other = obj as IAddress; if (other == null) { return(false); } return(PostalCode.EqualsIgnoreCase(other.PostalCode) && Phone.EqualsIgnoreCase(other.Phone) && EMail.EqualsIgnoreCase(other.EMail) && Country.EqualsIgnoreCase(other.Country) && City.EqualsIgnoreCase(other.City) && Region.EqualsIgnoreCase(other.Region) && Address1.EqualsIgnoreCase(other.Address1) && Address2.EqualsIgnoreCase(other.Address2)); }
public void FillForm(string firstName, string lastName, string pass, string email, string address, string city, string postcode, string phone) { if (firstName != "") { Driver.ScrollToElement(FirstNameField); FirstNameField.SendKeys(firstName); } if (lastName != "") { Driver.ScrollToElement(LastNameField); LastNameField.SendKeys(lastName); } if (pass != "") { Driver.ScrollToElement(PasswordField); PasswordField.SendKeys(pass); } if (email != "") { if (email == "none") { Driver.ScrollToElement(EmailField); EmailField.Clear(); } else { Driver.ScrollToElement(EmailField); EmailField.TypeText(email); } } if (address != "") { Driver.ScrollToElement(AddressField); AddressField.SendKeys(address); } if (city != "") { Driver.ScrollToElement(CityField); CityField.SendKeys(city); } if (postcode != "") { Driver.ScrollToElement(PostalCode); PostalCode.SendKeys(postcode); } if (phone != "") { MobilePhone.SendKeys(phone); } }
public void Add(PostalCode postalCode) { if (prefectureDictionary.ContainsKey(postalCode.Prefecture)) { prefectureDictionary[postalCode.Prefecture].Add(postalCode); } else { var prefectureSet = new PrefectureSet(postalCode.Prefecture); prefectureSet.Add(postalCode); prefectureDictionary[postalCode.Prefecture] = prefectureSet; prefectureSets.Add(prefectureSet); } }
public void PostalCode_IsValidTest() { var result1 = PostalCode.IsValid(null); var result2 = PostalCode.IsValid("12345"); var result3 = PostalCode.IsValid("ddddd"); var result4 = PostalCode.IsValid("d123d"); var result5 = PostalCode.IsValid("dddddghhj"); Assert.False(result1); Assert.True(result2); Assert.False(result3); Assert.False(result4); Assert.False(result5); }
internal static IPostalCode ToDomain(this PostalCodeModel postalCodeModel, IConverter contactModelConverter) { NullGuard.NotNull(postalCodeModel, nameof(postalCodeModel)) .NotNull(contactModelConverter, nameof(contactModelConverter)); ICountry country = contactModelConverter.Convert <CountryModel, ICountry>(postalCodeModel.Country); IPostalCode postalCode = new PostalCode(country, postalCodeModel.PostalCode, postalCodeModel.City, postalCodeModel.State); postalCode.AddAuditInformation(postalCodeModel.CreatedUtcDateTime, postalCodeModel.CreatedByIdentifier, postalCodeModel.ModifiedUtcDateTime, postalCodeModel.ModifiedByIdentifier); postalCode.SetDeletable(postalCodeModel.Deletable); return(postalCode); }
// GET: PostalCodes/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PostalCode postalCode = db.PostalCode.Find(id); if (postalCode == null) { return(HttpNotFound()); } return(View(postalCode)); }
public static void QueryCsa(GeographicCodeType geoCode, string City, string Country, string ZipCode, string State, string Street, string Xstreet) { ///* Instantiate an instance of the proxy class. */ QueryCsaService service = new QueryCsaService(); service.wsMessageHeader = getHeader(); SecurityHelper.prepareSoapContext(service.RequestSoapContext); try{ QueryCsaRequest request = new QueryCsaRequest(); if (!string.IsNullOrEmpty(ZipCode)) { PostalCode code = new PostalCode(); code.uspsPostalCd = ZipCode; request.zip = code; } if (!string.IsNullOrEmpty(Street)) { request.street = Street; } if (!string.IsNullOrEmpty(Xstreet)) { request.xStreet = Xstreet; } if (!string.IsNullOrEmpty(State)) { request.state = State; } request.geoCode = geoCode; if (!string.IsNullOrEmpty(ZipCode)) { request.city = City; } if (!string.IsNullOrEmpty(ZipCode)) { request.country = Country; } QueryCsaReply reply = service.QueryCsa(request); } catch { throw; } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (ReferenceNumber != null) { hashCode = hashCode * 59 + ReferenceNumber.GetHashCode(); } if (FirstName != null) { hashCode = hashCode * 59 + FirstName.GetHashCode(); } if (LastName != null) { hashCode = hashCode * 59 + LastName.GetHashCode(); } if (Address1 != null) { hashCode = hashCode * 59 + Address1.GetHashCode(); } if (Address2 != null) { hashCode = hashCode * 59 + Address2.GetHashCode(); } if (City != null) { hashCode = hashCode * 59 + City.GetHashCode(); } if (State != null) { hashCode = hashCode * 59 + State.GetHashCode(); } if (CountryCode != null) { hashCode = hashCode * 59 + CountryCode.GetHashCode(); } if (PostalCode != null) { hashCode = hashCode * 59 + PostalCode.GetHashCode(); } if (PhoneNumber != null) { hashCode = hashCode * 59 + PhoneNumber.GetHashCode(); } return(hashCode); } }
public string ToJSONString() { string dateFormat = "dd-MMM-yyyy"; string amountFormat = "00.00"; return(string.Format("$!$\r\n \"invoiceType\": \"{0}\",\r\n \"supplierNumber\": \"{1}\",\r\n \"supplierSiteNumber\": \"{2}\",\r\n \"invoiceDate\": \"{3}\",\r\n \"invoiceNumber\": \"{4}\",\r\n \"invoiceAmount\": {5},\r\n \"payGroup\": \"{6}\",\r\n \"dateInvoiceReceived\": \"{7}\",\r\n \"dateGoodsReceived\": \"{8}\",\r\n \"remittanceCode\": \"{9}\",\r\n \"specialHandling\": \"{10}\",\r\n \"nameLine1\": \"{11}\",\r\n \"nameLine2\": \"{12}\",\r\n \"addressLine1\": \"{13}\",\r\n \"addressLine2\": \"{14}\",\r\n \"addressLine3\": \"{15}\",\r\n \"city\": \"{16}\",\r\n \"country\": \"{17}\",\r\n \"province\": \"{18}\",\r\n \"postalCode\": \"{19}\",\r\n \"qualifiedReceiver\": \"{20}\",\r\n \"terms\": \"{21}\",\r\n \"payAloneFlag\": \"{22}\",\r\n \"paymentAdviceComments\": \"{23}\",\r\n \"remittanceMessage1\": \"{24}\",\r\n \"remittanceMessage2\": \"{25}\",\r\n \"remittanceMessage3\": \"{26}\",\r\n \"glDate\": \"{27}\",\r\n \"invoiceBatchName\": \"{28}\",\r\n \"currencyCode\": \"{29}\",\r\n \"invoiceLineDetails\": [$!$\r\n \"invoiceLineNumber\": {30},\r\n \"invoiceLineType\": \"{31}\",\r\n \"lineCode\": \"{32}\",\r\n \"invoiceLineAmount\": {33},\r\n \"defaultDistributionAccount\": \"{34}\",\r\n \"description\": \"{35}\",\r\n \"taxClassificationCode\": \"{36}\",\r\n \"distributionSupplier\": \"{37}\",\r\n \"info1\": \"{38}\",\r\n \"info2\": \"{39}\",\r\n \"info3\": \"{40}\"\r\n $&$]\r\n$&$", InvoiceType, SupplierNumber, SupplierSiteNumber.ToString("000"), InvoiceDate.ToLocalTime().ToString(dateFormat), InvoiceNumber, InvoiceAmount.ToString(amountFormat), PayGroup, DateInvoiceReceived.ToLocalTime().ToString(dateFormat), DateGoodsReceived.HasValue ? DateGoodsReceived.Value.ToLocalTime().ToString(dateFormat) : "", RemittanceCode, (SpecialHandling ? "D" : "N"), NameLine1, NameLine2, AddressLine1, AddressLine2, AddressLine3, City, Country, Province, PostalCode = !string.IsNullOrEmpty(PostalCode) ? PostalCode.Replace(" ", ""): string.Empty, QualifiedReceiver, Terms, PayAloneFlag, PaymentAdviceComments, RemittanceMessage1, RemittanceMessage2, RemittanceMessage3, GLDate.HasValue ? GLDate.Value.ToLocalTime().ToString(dateFormat) : "", InvoiceBatchName, CurrencyCode, InvoiceLineNumber, InvoiceLineType, LineCode, InvoiceLineAmount.ToString(amountFormat), DefaultDistributionAccount, Description, TaxClassificationCode, DistributionSupplier, Info1, Info2, Info3 ).Replace("$!$", "{").Replace("$&$", "}")); }
public async Task <UserDto> HandleAsync(CreateUser command) { if (!(await _checkEmailAvailability.IsAvailable(command.Email))) { throw new EmailAlreadyInUseException($"The email '{command.Email}' is already in use."); } User user = new User(new EntityId(command.Id), command.Name, command.Surname, Email.FromString(command.Email), Password.FromString(command.Password), command.Country, string.IsNullOrEmpty(command.Phone) ? null : Phone.FromString(command.Phone), string.IsNullOrEmpty(command.PostalCode) ? null : PostalCode.FromString(command.PostalCode)); await _usersRepository.AddAsync(user); return(UserMapper.From(user)); }
public override bool Validate() { var hasError = false; if (PostalCode == null) { hasError = true; } if (PostalCode.Count() > 5) { hasError = true; } return(hasError); }
public override int GetHashCode() { unchecked { int hash = 17; hash = hash * 23 + (AddressLine1 == null ? 0 : AddressLine1.GetHashCode()); hash = hash * 23 + (AddressLine2 == null ? 0 : AddressLine2.GetHashCode()); hash = hash * 23 + (City == null ? 0 : City.GetHashCode()); hash = hash * 23 + (ModifiedDate == default(DateTime) ? 0 : ModifiedDate.GetHashCode()); hash = hash * 23 + (PostalCode == null ? 0 : PostalCode.GetHashCode()); hash = hash * 23 + (Rowguid == default(Guid) ? 0 : Rowguid.GetHashCode()); hash = hash * 23 + (StateProvinceId == default(int) ? 0 : StateProvinceId.GetHashCode()); return(hash); } }
//public async Task<IActionResult> Chiba(int page = 1) //{ // var jobs = _IJobsRepository.GetJobsByProvince("chiba"); // var model = await PagingList.CreateAsync<Job>(jobs, 10, page, "Chiba"); // ViewData["TotalJobsFound"] = model.TotalRecordCount; // return View(model); //} //public async Task<IActionResult> Tokyo(int page = 1) //{ // var jobs = _IJobsRepository.GetJobsByProvince("tokyo"); // var model = await PagingList.CreateAsync<Job>(jobs, 10, page, "tokyo"); // ViewData["TotalJobsFound"] = model.TotalRecordCount; // return View(model); //} //public async Task<IActionResult> Gunma(int page = 1) //{ // var jobs = _IJobsRepository.GetJobsByProvince("gunma"); // var model = await PagingList.CreateAsync<Job>(jobs, 10, page, "Gunma"); // ViewData["TotalJobsFound"] = model.TotalRecordCount; // return View(model); //} //public async Task<IActionResult> Ibaraki(int page = 1) //{ // var jobs = _IJobsRepository.GetJobsByProvince("ibaraki"); // var model = await PagingList.CreateAsync<Job>(jobs, 10, page, "Ibaraki"); // ViewData["TotalJobsFound"] = model.TotalRecordCount; // return View(model); //} //public async Task<IActionResult> Kanagawa(int page = 1) //{ // var jobs = _IJobsRepository.GetJobsByProvince("kanagawa"); // var model = await PagingList.CreateAsync<Job>(jobs, 10, page, "Kanagawa"); // ViewData["TotalJobsFound"] = model.TotalRecordCount; // return View(model); //} //public async Task<IActionResult> Saitma(int page = 1) //{ // var jobs = _IJobsRepository.GetJobsByProvince("saitma"); // var model = await PagingList.CreateAsync<Job>(jobs, 10, page, "Saitma"); // ViewData["TotalJobsFound"] = model.TotalRecordCount; // return View(model); //} //public async Task<IActionResult> Tochigi(int page = 1) //{ // var jobs = _IJobsRepository.GetJobsByProvince("tochigi"); // var model = await PagingList.CreateAsync<Job>(jobs, 10, page, "Tochigi"); // ViewData["TotalJobsFound"] = model.TotalRecordCount; // return View(model); //} //[Authorize(Roles = "candidate")] public IActionResult JobDetails(long id, string returnUrl = null) { Job job = _IJobsRepository.GetJobsById(id); Client client = _clientRepository.GetById(job.ClientId); var businessStream = _businessStreamRepository.GetById(job.BusinessStreamID); var postalcode = new PostalCode(); if (job.PostalCodeId != 0) { postalcode = _postalCodeRepository.GetById(job.PostalCodeId); } JobDetailsViewModel model = new JobDetailsViewModel(job, client, businessStream, postalcode); return(View(model)); }
public void Validate_PostalCodeModelWithInvalidPostalCode_WithError() { using (new CultureInfoScope("nl-BE")) { var model = new PostalCodeModel { Country = Country.BE, PostalCode = PostalCode.Parse("2629 JD"), }; DataAnnotationsAssert.WithErrors(model, ValidationTestMessage.Error("De postcode 2629JD is niet geldig voor België.", "PostalCode", "Country") ); } }
/// <summary> /// Serves as a hash function for a particular type. /// </summary> /// <returns> /// A hash code for the current <see cref="T:System.Object" />. /// </returns> /// <filterpriority>2</filterpriority> public override int GetHashCode() { unchecked { int result = FirstStreetAddress != null?FirstStreetAddress.GetHashCode() : 0; result = (result * 397) ^ (SecondStreetAddress != null ? SecondStreetAddress.GetHashCode() : 0); result = (result * 397) ^ (CityName != null ? CityName.GetHashCode() : 0); //result = (result * 397) ^ (CountyArea != null ? CountyArea.GetHashCode() : 0); result = (result * 397) ^ (StateProvince != null ? StateProvince.GetHashCode() : 0); //result = (result * 397) ^ (Country != null ? Country.GetHashCode() : 0); result = (result * 397) ^ (PostalCode != null ? PostalCode.GetHashCode() : 0); return(result); } }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { FirstName = MKValidation.Capitalise(FirstName); LastName = MKValidation.Capitalise(LastName); FullName = LastName + ", " + FirstName; HomePhone = Phoneverification(HomePhone); WorkPhone = Phoneverification(WorkPhone); ProvinceCode = ProvinceCode.ToUpper(); PostalCode = PostalCode.ToUpper(); if (PostalCode.Length == 6) { PostalCode = PostalCode.Insert(3, " "); } yield return(ValidationResult.Success); }
public override int GetHashCode() { int hash = 1; if (Revision != 0) { hash ^= Revision.GetHashCode(); } if (RegionCode.Length != 0) { hash ^= RegionCode.GetHashCode(); } if (LanguageCode.Length != 0) { hash ^= LanguageCode.GetHashCode(); } if (PostalCode.Length != 0) { hash ^= PostalCode.GetHashCode(); } if (SortingCode.Length != 0) { hash ^= SortingCode.GetHashCode(); } if (AdministrativeArea.Length != 0) { hash ^= AdministrativeArea.GetHashCode(); } if (Locality.Length != 0) { hash ^= Locality.GetHashCode(); } if (Sublocality.Length != 0) { hash ^= Sublocality.GetHashCode(); } hash ^= addressLines_.GetHashCode(); hash ^= recipients_.GetHashCode(); if (Organization.Length != 0) { hash ^= Organization.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override int GetHashCode() { unchecked { var hashCode = (Gcp != null ? Gcp.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Addr2 != null ? Addr2.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Addr3 != null ? Addr3.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Addr4 != null ? Addr4.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (PostalCode != null ? PostalCode.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (City != null ? City.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Tel != null ? Tel.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Mail != null ? Mail.GetHashCode() : 0); return(hashCode); } }
public PostalAddress GetPostalAddress(string address1, string address2, string address3, PostalCode postalCode, City city, Country country) { var postalAddresses = new PostalAddresses(this.Session).Extent(); if (!string.IsNullOrEmpty(address1)) { postalAddresses.Filter.AddEquals(Meta.Address1, address1); } if (!string.IsNullOrEmpty(address2)) { postalAddresses.Filter.AddEquals(Meta.Address2, address2); } if (!string.IsNullOrEmpty(address3)) { postalAddresses.Filter.AddEquals(Meta.Address3, address3); } if (postalCode != null) { postalAddresses.Filter.AddContains(Meta.GeographicBoundaries, postalCode); } if (city != null) { postalAddresses.Filter.AddContains(Meta.GeographicBoundaries, city); } if (country != null) { postalAddresses.Filter.AddContains(Meta.GeographicBoundaries, country); } return postalAddresses.First; }
public void FiveDigitPostalCode() { sut = PostalCode.Create(ValidPostalCode); Assert.AreEqual(ValidPostalCode, sut.ToString()); }
/// <summary> /// There are no comments for PostalCode in the schema. /// </summary> public void AddToPostalCode(PostalCode postalCode) { base.AddObject("PostalCode", postalCode); }
public Address(string line1, string town, PostalCode postalCode) { Line1 = line1; Town = town; PostalCode = postalCode; }
/// <summary> /// Assigns the postal code. /// </summary> /// <param name="postalCode">The postal code.</param> /// <returns>An AddressBuilder.</returns> public AddressBuilder WithPostalCode(PostalCode postalCode) { _postalCode = postalCode; return this; }
public void Constructor_InvalidPostalCode_ThrowsException() { PostalCode postalCode = new PostalCode("ThePostalCode"); }
public void Constructor_ValidPostalCode_Succeeds() { PostalCode postalCode1 = new PostalCode("21046"); PostalCode postalCode2 = new PostalCode("21046-1234"); }
/// <summary> /// Unpacks the message from a MessagePack object /// This method should not be called directly, use deserialize instead. /// </summary> /// <param name="unpacker">The unpacker</param> public void UnpackFromMessage(Unpacker unpacker) { string dcs, dac, dad, dbd, dbb, day, dau, dag, dai, daj, dak, dcg; int dbc; if (!unpacker.IsMapHeader) throw SerializationExceptions.NewIsNotMapHeader(); if (UnpackHelpers.GetItemsCount(unpacker) != MapCount) throw SerializationExceptions.NewUnexpectedArrayLength(MapCount, UnpackHelpers.GetItemsCount(unpacker)); for (var i = 0; i < MapCount; i++) { string key; if (!unpacker.ReadString(out key)) throw SerializationExceptions.NewUnexpectedEndOfStream(); switch (key) { case "DCS": { if (!unpacker.ReadString(out dcs)) throw SerializationExceptions.NewMissingProperty("dcs"); Dcs = dcs; break; } case "DAC": { if (!unpacker.ReadString(out dac)) throw SerializationExceptions.NewMissingProperty("dac"); Dac = dac; break; } case "DAD": { if (!unpacker.ReadString(out dad)) throw SerializationExceptions.NewMissingProperty("dad"); Dad = dad; break; } case "DBD": { if (!unpacker.ReadString(out dbd)) throw SerializationExceptions.NewMissingProperty("dbd"); Dbd = DateTime.Parse(dbd); break; } case "DBB": { if (!unpacker.ReadString(out dbb)) throw SerializationExceptions.NewMissingProperty("dbb"); Dbb = DateTime.Parse(dbb); break; } case "DBC": { if (!unpacker.ReadInt32(out dbc)) throw SerializationExceptions.NewMissingProperty("dbc"); Dbc = (Sex) dbc; break; } case "DAY": { if (!unpacker.ReadString(out day)) throw SerializationExceptions.NewMissingProperty("day"); Day = GetEyeColor(day); break; } case "DAU": { if (!unpacker.ReadString(out dau)) throw SerializationExceptions.NewMissingProperty("dau"); Dau = new Height {AnsiFormat = dau}; break; } case "DAG": { if (!unpacker.ReadString(out dag)) throw SerializationExceptions.NewMissingProperty("dag"); Dag = dag; break; } case "DAI": { if (!unpacker.ReadString(out dai)) throw SerializationExceptions.NewMissingProperty("dai"); Dai = dai; break; } case "DAJ": { if (!unpacker.ReadString(out daj)) throw SerializationExceptions.NewMissingProperty("daj"); Daj = daj; break; } case "DAK": { if (!unpacker.ReadString(out dak)) throw SerializationExceptions.NewMissingProperty("dak"); Dak = new PostalCode {AnsiFormat = dak}; break; } case "DCG": { if (!unpacker.ReadString(out dcg)) throw SerializationExceptions.NewMissingProperty("dcg"); Dcg = dcg; break; } case "ZAA": { if (!unpacker.Read()) throw SerializationExceptions.NewMissingProperty("zaa"); var ms = new MemoryStream(unpacker.LastReadData.AsBinary()); Image = Image.FromStream(ms); break; } case "ZAB": { if (!unpacker.Read()) throw SerializationExceptions.NewMissingProperty("zab"); Fingerprint = new Fingerprint {AsIsoTemplate = unpacker.LastReadData.AsBinary()}; break; } } } }
public void GetHashCode_returns_equal_for_Equal_PostalCodeRanges( PostalCode start, PostalCode end) { var r1 = new PostalCodeRange(start, end); var r2 = new PostalCodeRange(start, end); Assert.AreEqual(r1.GetHashCode(), r2.GetHashCode()); }
public bool Equals(PostalCode other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return Equals(other.Outcode, Outcode) && Equals(other.Incode, Incode); }
/// <summary> /// Create a new PostalCode object. /// </summary> /// <param name="postalCodeID">Initial value of PostalCodeID.</param> /// <param name="areaName">Initial value of AreaName.</param> /// <param name="postalCodeStart">Initial value of PostalCodeStart.</param> /// <param name="postalCodeEnd">Initial value of PostalCodeEnd.</param> public static PostalCode CreatePostalCode(int postalCodeID, string areaName, decimal postalCodeStart, decimal postalCodeEnd) { PostalCode postalCode = new PostalCode(); postalCode.PostalCodeID = postalCodeID; postalCode.AreaName = areaName; postalCode.PostalCodeStart = postalCodeStart; postalCode.PostalCodeEnd = postalCodeEnd; return postalCode; }
public void DoesNotEqualToDifferentTypeObject() { sut = PostalCode.Create(ValidPostalCode); Assert.AreNotEqual(new DateTime(), sut); }