本文整理汇总了C#中EmailAddress.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# EmailAddress.Equals方法的具体用法?C# EmailAddress.Equals怎么用?C# EmailAddress.Equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EmailAddress
的用法示例。
在下文中一共展示了EmailAddress.Equals方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WhenGivenAnEmailWithUpperCases_WhenMatchingSameEmailWithLowerCase_ThenShouldMatch
public void WhenGivenAnEmailWithUpperCases_WhenMatchingSameEmailWithLowerCase_ThenShouldMatch()
{
// arrange
var lower = new EmailAddress("[email protected]");
var upper = new EmailAddress("[email protected]");
// act
var result = lower.Equals(upper);
// assert
result.Should().BeTrue();
}
示例2: EqualsMethod
public void EqualsMethod()
{
var email1 = new EmailAddress("[email protected]");
var email2 = new EmailAddress("[email protected]");
Assert.True(email1.Equals(email2));
}
示例3: EmailAddress_Unit_Equals2_ObjIsSameObject
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);
}
示例4: EmailAddress_Unit_Equals2_ObjHasDifferentLocalPart
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);
}
示例5: EmailAddress_Unit_Equals1_ObjIsNull
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);
}
示例6: EmailAddress_Unit_Equals1_ObjIsEquivalentObject
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);
}
示例7: SignUp
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());
}