public void TestEmailAddressEquality() { var left = new EmailAddress("*****@*****.**", "test"); var right = new EmailAddress("*****@*****.**", "Test"); var up = new EmailAddress("*****@*****.**", "test"); var down = new EmailAddress("*****@*****.**", "Test"); Assert.True(left.Equals(left)); Assert.True(left.Equals(right)); Assert.False(left.Equals(up)); Assert.False(left.Equals(down)); }
public void CanEqualAnotherInstanceOfTypedValue() { var lhs = new EmailAddress("*****@*****.**"); var rhs = new EmailAddress("*****@*****.**"); Assert.True(lhs.Equals(rhs)); }
public void Comparing_simple_value_objects_of_different_types_returns_false() { var emailAddress1 = new EmailAddress("*****@*****.**"); var emailAddress2 = new EmailAddress2("*****@*****.**"); emailAddress1.Equals(emailAddress2).Should().BeFalse(); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is TeamMember other && ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) && ((ReferenceId == null && other.ReferenceId == null) || (ReferenceId?.Equals(other.ReferenceId) == true)) && ((IsOwner == null && other.IsOwner == null) || (IsOwner?.Equals(other.IsOwner) == true)) && ((Status == null && other.Status == null) || (Status?.Equals(other.Status) == true)) && ((GivenName == null && other.GivenName == null) || (GivenName?.Equals(other.GivenName) == true)) && ((FamilyName == null && other.FamilyName == null) || (FamilyName?.Equals(other.FamilyName) == true)) && ((EmailAddress == null && other.EmailAddress == null) || (EmailAddress?.Equals(other.EmailAddress) == true)) && ((PhoneNumber == null && other.PhoneNumber == null) || (PhoneNumber?.Equals(other.PhoneNumber) == true)) && ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) && ((UpdatedAt == null && other.UpdatedAt == null) || (UpdatedAt?.Equals(other.UpdatedAt) == true)) && ((AssignedLocations == null && other.AssignedLocations == null) || (AssignedLocations?.Equals(other.AssignedLocations) == true))); }
public void EqualsMethod() { var email1 = new EmailAddress("*****@*****.**"); var email2 = new EmailAddress("*****@*****.**"); Assert.True(email1.Equals(email2)); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is CreateCustomerRequest other && ((IdempotencyKey == null && other.IdempotencyKey == null) || (IdempotencyKey?.Equals(other.IdempotencyKey) == true)) && ((GivenName == null && other.GivenName == null) || (GivenName?.Equals(other.GivenName) == true)) && ((FamilyName == null && other.FamilyName == null) || (FamilyName?.Equals(other.FamilyName) == true)) && ((CompanyName == null && other.CompanyName == null) || (CompanyName?.Equals(other.CompanyName) == true)) && ((Nickname == null && other.Nickname == null) || (Nickname?.Equals(other.Nickname) == true)) && ((EmailAddress == null && other.EmailAddress == null) || (EmailAddress?.Equals(other.EmailAddress) == true)) && ((Address == null && other.Address == null) || (Address?.Equals(other.Address) == true)) && ((PhoneNumber == null && other.PhoneNumber == null) || (PhoneNumber?.Equals(other.PhoneNumber) == true)) && ((ReferenceId == null && other.ReferenceId == null) || (ReferenceId?.Equals(other.ReferenceId) == true)) && ((Note == null && other.Note == null) || (Note?.Equals(other.Note) == true)) && ((Birthday == null && other.Birthday == null) || (Birthday?.Equals(other.Birthday) == true))); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is Customer other && ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) && ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) && ((UpdatedAt == null && other.UpdatedAt == null) || (UpdatedAt?.Equals(other.UpdatedAt) == true)) && ((Cards == null && other.Cards == null) || (Cards?.Equals(other.Cards) == true)) && ((GivenName == null && other.GivenName == null) || (GivenName?.Equals(other.GivenName) == true)) && ((FamilyName == null && other.FamilyName == null) || (FamilyName?.Equals(other.FamilyName) == true)) && ((Nickname == null && other.Nickname == null) || (Nickname?.Equals(other.Nickname) == true)) && ((CompanyName == null && other.CompanyName == null) || (CompanyName?.Equals(other.CompanyName) == true)) && ((EmailAddress == null && other.EmailAddress == null) || (EmailAddress?.Equals(other.EmailAddress) == true)) && ((Address == null && other.Address == null) || (Address?.Equals(other.Address) == true)) && ((PhoneNumber == null && other.PhoneNumber == null) || (PhoneNumber?.Equals(other.PhoneNumber) == true)) && ((Birthday == null && other.Birthday == null) || (Birthday?.Equals(other.Birthday) == true)) && ((ReferenceId == null && other.ReferenceId == null) || (ReferenceId?.Equals(other.ReferenceId) == true)) && ((Note == null && other.Note == null) || (Note?.Equals(other.Note) == true)) && ((Preferences == null && other.Preferences == null) || (Preferences?.Equals(other.Preferences) == true)) && ((Groups == null && other.Groups == null) || (Groups?.Equals(other.Groups) == true)) && ((CreationSource == null && other.CreationSource == null) || (CreationSource?.Equals(other.CreationSource) == true)) && ((GroupIds == null && other.GroupIds == null) || (GroupIds?.Equals(other.GroupIds) == true)) && ((SegmentIds == null && other.SegmentIds == null) || (SegmentIds?.Equals(other.SegmentIds) == true))); }
public void ObjectEqual_AgainstNull() { EmailAddress value1 = new EmailAddress("*****@*****.**"); EmailAddress value2 = null; var result = value1.Equals(value2); Assert.IsFalse(result); }
public void ObjectEqual_AgainstSameValue() { EmailAddress value1 = new EmailAddress("*****@*****.**"); EmailAddress value2 = new EmailAddress("*****@*****.**"); var result = value1.Equals(value2); Assert.IsTrue(result); }
public void ObjectEqual_AgainstDifferentValue() { EmailAddress value1 = new EmailAddress("*****@*****.**"); EmailAddress value2 = new EmailAddress("*****@*****.**"); var result = value1.Equals(value2); Assert.IsFalse(result); }
public void UpdateEmailAddress(EmailAddress emailAddress) { if (!EmailAddress.Equals(emailAddress)) { EmailAddress = emailAddress; RecordedEvents.Add(new ContactEmailAddressUpdated(emailAddress.Value)); } }
public void WhenIsNotEmailAddress_ThenReturnFalse() { var sut = new EmailAddress("*****@*****.**"); var result = sut.Equals(new object()); Assert.That(result, Is.False); }
public void Two_PVO_of_the_same_content_are_equal() { var emailAddress1 = new EmailAddress("*****@*****.**"); var emailAddress2 = new EmailAddress("*****@*****.**"); emailAddress1.Equals(emailAddress2).Should().BeTrue(); emailAddress1.GetHashCode().Equals(emailAddress2.GetHashCode()).Should().BeTrue(); }
public void CanEqualValueAsObject() { var email = new EmailAddress("*****@*****.**"); // ReSharper disable SuspiciousTypeConversion.Global Assert.True(email.Equals((Object)"*****@*****.**")); // ReSharper restore SuspiciousTypeConversion.Global }
public void ChangeEmailAddress(string emailAddress, DateTime asOfDate) { if (_changeTracker.CanChangeEmailAddress(asOfDate) && !EmailAddress.Equals(emailAddress)) { EmailAddress = emailAddress; _changeTracker = _changeTracker.EmailAddressChangedOn(asOfDate); } }
public bool Equals(SourceControlSettings other) { return(other != null && UserName.Equals(other.UserName) && EmailAddress.Equals(other.EmailAddress) && DefaultRepositoryLocation.Equals(other.DefaultRepositoryLocation) && Repositories.SequenceEqual(other.Repositories) && CommandPromptLocation.Equals(other.CommandPromptLocation)); }
public void WhenDifferentObjsHaveEqualAddress_ThenReturnTrue() { var otherEmail = new EmailAddress("*****@*****.**"); var sut = new EmailAddress(otherEmail.Address); var result = sut.Equals(otherEmail); Assert.That(result, Is.True); }
public void WhenDifferentObjsHasNotEqualAddress_ThenReturnFalse() { var otherEmail = new EmailAddress("*****@*****.**"); var sut = new EmailAddress("*****@*****.**"); var result = sut.Equals(otherEmail); Assert.That(result, Is.False); }
public override bool Equals(object obj) { var user = obj as UserAccount; if (user == null) { return(false); } return(Id.Equals(user.Id) && EmailAddress.Equals(user.EmailAddress, StringComparison.CurrentCultureIgnoreCase)); }
public void WhenGivenAnEmailWithUpperCases_WhenMatchingSameEmailWithLowerCase_ThenShouldMatch() { // arrange var lower = new EmailAddress("*****@*****.**"); var upper = new EmailAddress("*****@*****.**"); // act var result = lower.Equals(upper); // assert result.Should().BeTrue(); }
public override bool Equals(object obj) { if (this == obj) { return(true); } if (!(obj is ContactData)) { return(false); } var contactData = (ContactData)obj; return(EmailAddress.Equals(contactData.EmailAddress) && TelephoneNumber.Equals(contactData.TelephoneNumber)); }
public override bool Equals(object obj) { var result = false; if (obj != null && obj.GetType() == typeof(Employee)) { var that = (Employee)obj; result = Id.Equals(that.Id) && Name.Equals(that.Name) && JobTitle.Equals(that.JobTitle) && EmailAddress.Equals(that.EmailAddress) && ManagerId.Equals(that.ManagerId); } return(result); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is OrderFulfillmentRecipient other && ((CustomerId == null && other.CustomerId == null) || (CustomerId?.Equals(other.CustomerId) == true)) && ((DisplayName == null && other.DisplayName == null) || (DisplayName?.Equals(other.DisplayName) == true)) && ((EmailAddress == null && other.EmailAddress == null) || (EmailAddress?.Equals(other.EmailAddress) == true)) && ((PhoneNumber == null && other.PhoneNumber == null) || (PhoneNumber?.Equals(other.PhoneNumber) == true)) && ((Address == null && other.Address == null) || (Address?.Equals(other.Address) == true))); }
public override bool Equals(object obj) { var respondent = obj as Respondent; if (respondent != null) { return(RespondentID.ToString().Equals(respondent.RespondentID.ToString(), StringComparison.Ordinal) && FirstName.Equals(respondent.FirstName) && LastName.Equals(respondent.LastName) && EmailAddress.Equals(respondent.EmailAddress) && AddressLine1.Equals(respondent.AddressLine1) && AddressLine2.Equals(respondent.AddressLine2) && City.Equals(respondent.City) && StateAbbr.Equals(respondent.StateAbbr) && ZipCode.Equals(respondent.ZipCode) && LastSurvey.Equals(respondent.LastSurvey)); } return(false); }
public ActionResult SignUp(AccountRegistration information) { var username = new Username(information.Username); bool usernameIsAvailable = _accountRegistrationService.IsUsernameAvailable(username); if (!usernameIsAvailable) { TempData.RegistrationFailureReason.Store(RegistrationFailureReason.UsernameNotAvailable); TempData.AccountRegistrationInformation.Store(information); return(RedirectToAction <AccountController>(c => c.SignUp())); } var password = new Password(information.Password); var passwordConfirmation = new Password(information.PasswordConfirmation); if (!password.Equals(passwordConfirmation)) { TempData.RegistrationFailureReason.Store(RegistrationFailureReason.PasswordsDoNotMatch); return(RedirectToAction <AccountController>(c => c.SignUp())); } var emailAddress = new EmailAddress(information.Email); var emailAddressConfirmation = new EmailAddress(information.EmailConfirmation); if (!emailAddress.Equals(emailAddressConfirmation)) { TempData.RegistrationFailureReason.Store(RegistrationFailureReason.EmailsDoNotMatch); return(RedirectToAction <AccountController>(c => c.SignUp())); } var foo = new GivenNames(); var fullName = new FullName(new Name(information.LastName), new GivenNames(information.FirstName)); var accountRegistration = new AccountManagement.AccountRegistration(username, password, fullName, new EmailAddress(information.Email)); _accountRegistrationService.CreateAccount(accountRegistration); TempData.NewAccountUsername.Store(accountRegistration.Username); return(RedirectToAction <AccountController>(c => c.SignUpComplete())); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is CustomerFilter other && ((CreationSource == null && other.CreationSource == null) || (CreationSource?.Equals(other.CreationSource) == true)) && ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) && ((UpdatedAt == null && other.UpdatedAt == null) || (UpdatedAt?.Equals(other.UpdatedAt) == true)) && ((EmailAddress == null && other.EmailAddress == null) || (EmailAddress?.Equals(other.EmailAddress) == true)) && ((PhoneNumber == null && other.PhoneNumber == null) || (PhoneNumber?.Equals(other.PhoneNumber) == true)) && ((ReferenceId == null && other.ReferenceId == null) || (ReferenceId?.Equals(other.ReferenceId) == true)) && ((GroupIds == null && other.GroupIds == null) || (GroupIds?.Equals(other.GroupIds) == true))); }
public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is InvoiceRecipient other && ((CustomerId == null && other.CustomerId == null) || (CustomerId?.Equals(other.CustomerId) == true)) && ((GivenName == null && other.GivenName == null) || (GivenName?.Equals(other.GivenName) == true)) && ((FamilyName == null && other.FamilyName == null) || (FamilyName?.Equals(other.FamilyName) == true)) && ((EmailAddress == null && other.EmailAddress == null) || (EmailAddress?.Equals(other.EmailAddress) == true)) && ((Address == null && other.Address == null) || (Address?.Equals(other.Address) == true)) && ((PhoneNumber == null && other.PhoneNumber == null) || (PhoneNumber?.Equals(other.PhoneNumber) == true)) && ((CompanyName == null && other.CompanyName == null) || (CompanyName?.Equals(other.CompanyName) == true))); }
/// <summary> /// Returns true if ContactDetailsBase instances are equal /// </summary> /// <param name="other">Instance of ContactDetailsBase to be compared</param> /// <returns>Boolean</returns> public bool Equals(ContactDetailsBase other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( EmailAddress == other.EmailAddress || EmailAddress != null && EmailAddress.Equals(other.EmailAddress) ) && ( EmailMessageType == other.EmailMessageType || EmailMessageType != null && EmailMessageType.Equals(other.EmailMessageType) )); }
public void EmailAddress_Unit_Equals2_ObjIsSameObject() { String localPart = "Chad.Greer"; String domain = "ParivedaSolutions.com"; EmailAddress target = new EmailAddress(localPart, domain); EmailAddress other = target; Boolean actual = target.Equals(other); Assert.AreEqual(true, actual); }
public void EmailAddress_Unit_Equals2_ObjHasDifferentLocalPart() { String localPart = "Chad.Greer"; String domain = "ParivedaSolutions.com"; EmailAddress target = new EmailAddress(localPart, domain); EmailAddress other = new EmailAddress(localPart + "Test", domain); Boolean actual = target.Equals(other); Assert.AreEqual(false, actual); }
public void EmailAddress_Unit_Equals1_ObjIsNull() { String localPart = "Chad.Greer"; String domain = "ParivedaSolutions.com"; EmailAddress target = new EmailAddress(localPart, domain); Object obj = null; Boolean actual = target.Equals(obj); Assert.AreEqual(false, actual); }
public void EmailAddress_Unit_Equals1_ObjIsEquivalentObject() { String localPart = "Chad.Greer"; String domain = "ParivedaSolutions.com"; EmailAddress target = new EmailAddress(localPart, domain); Object obj = new EmailAddress(localPart.ToUpperInvariant(), domain.ToUpperInvariant()); Boolean actual = target.Equals(obj); Assert.AreEqual(true, actual); }
public void CanEqualRawValue() { var email = new EmailAddress("*****@*****.**"); Assert.True(email.Equals("*****@*****.**")); }
public ActionResult SignUp(AccountRegistration information) { var username = new Username(information.Username); bool usernameIsAvailable = _accountRegistrationService.IsUsernameAvailable(username); if (!usernameIsAvailable) { TempData.RegistrationFailureReason.Store(RegistrationFailureReason.UsernameNotAvailable); TempData.AccountRegistrationInformation.Store(information); return RedirectToAction<AccountController>(c => c.SignUp()); } var password = new Password(information.Password); var passwordConfirmation = new Password(information.PasswordConfirmation); if (!password.Equals(passwordConfirmation)) { TempData.RegistrationFailureReason.Store(RegistrationFailureReason.PasswordsDoNotMatch); return RedirectToAction<AccountController>(c => c.SignUp()); } var emailAddress = new EmailAddress(information.Email); var emailAddressConfirmation = new EmailAddress(information.EmailConfirmation); if (!emailAddress.Equals(emailAddressConfirmation)) { TempData.RegistrationFailureReason.Store(RegistrationFailureReason.EmailsDoNotMatch); return RedirectToAction<AccountController>(c => c.SignUp()); } var foo = new GivenNames(); var fullName = new FullName(new Name(information.LastName), new GivenNames(information.FirstName)); var accountRegistration = new AccountManagement.AccountRegistration(username, password, fullName, new EmailAddress(information.Email)); _accountRegistrationService.CreateAccount(accountRegistration); TempData.NewAccountUsername.Store(accountRegistration.Username); return RedirectToAction<AccountController>(c => c.SignUpComplete()); }
/// <summary> /// Returns true if PaymentProductFieldValidators instances are equal /// </summary> /// <param name="other">Instance of PaymentProductFieldValidators to be compared</param> /// <returns>Boolean</returns> public bool Equals(PaymentProductFieldValidators other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( BoletoBancarioRequiredness == other.BoletoBancarioRequiredness || BoletoBancarioRequiredness != null && BoletoBancarioRequiredness.Equals(other.BoletoBancarioRequiredness) ) && ( EmailAddress == other.EmailAddress || EmailAddress != null && EmailAddress.Equals(other.EmailAddress) ) && ( ExpirationDate == other.ExpirationDate || ExpirationDate != null && ExpirationDate.Equals(other.ExpirationDate) ) && ( FixedList == other.FixedList || FixedList != null && FixedList.Equals(other.FixedList) ) && ( Iban == other.Iban || Iban != null && Iban.Equals(other.Iban) ) && ( Length == other.Length || Length != null && Length.Equals(other.Length) ) && ( Luhn == other.Luhn || Luhn != null && Luhn.Equals(other.Luhn) ) && ( Range == other.Range || Range != null && Range.Equals(other.Range) ) && ( RegularExpression == other.RegularExpression || RegularExpression != null && RegularExpression.Equals(other.RegularExpression) ) && ( TermsAndConditions == other.TermsAndConditions || TermsAndConditions != null && TermsAndConditions.Equals(other.TermsAndConditions) )); }
/// <summary> /// Returns true if Contact instances are equal /// </summary> /// <param name="other">Instance of Contact to be compared</param> /// <returns>Boolean</returns> public bool Equals(Contact other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id.Equals(other.Id) ) && ( GivenName == other.GivenName || GivenName != null && GivenName.Equals(other.GivenName) ) && ( Surname == other.Surname || Surname != null && Surname.Equals(other.Surname) ) && ( OrganizationName == other.OrganizationName || OrganizationName != null && OrganizationName.Equals(other.OrganizationName) ) && ( Role == other.Role || Role != null && Role.Equals(other.Role) ) && ( Notes == other.Notes || Notes != null && Notes.Equals(other.Notes) ) && ( EmailAddress == other.EmailAddress || EmailAddress != null && EmailAddress.Equals(other.EmailAddress) ) && ( WorkPhoneNumber == other.WorkPhoneNumber || WorkPhoneNumber != null && WorkPhoneNumber.Equals(other.WorkPhoneNumber) ) && ( MobilePhoneNumber == other.MobilePhoneNumber || MobilePhoneNumber != null && MobilePhoneNumber.Equals(other.MobilePhoneNumber) ) && ( FaxPhoneNumber == other.FaxPhoneNumber || FaxPhoneNumber != null && FaxPhoneNumber.Equals(other.FaxPhoneNumber) ) && ( Address1 == other.Address1 || Address1 != null && Address1.Equals(other.Address1) ) && ( Address2 == other.Address2 || Address2 != null && Address2.Equals(other.Address2) ) && ( City == other.City || City != null && City.Equals(other.City) ) && ( Province == other.Province || Province != null && Province.Equals(other.Province) ) && ( PostalCode == other.PostalCode || PostalCode != null && PostalCode.Equals(other.PostalCode) )); }