public void Birthdates() { var response = new ClaimsResponse(); // Verify that they both start out as null Assert.IsNull(response.BirthDateRaw); Assert.IsFalse(response.BirthDate.HasValue); // Verify that null can be set. response.BirthDate = null; response.BirthDateRaw = null; Assert.IsNull(response.BirthDateRaw); Assert.IsFalse(response.BirthDate.HasValue); // Verify that the strong-typed BirthDate property can be set and that it affects the raw property. response.BirthDate = DateTime.Parse("April 4, 1984"); Assert.AreEqual(4, response.BirthDate.Value.Month); Assert.AreEqual("1984-04-04", response.BirthDateRaw); // Verify that the raw property can be set with a complete birthdate and that it affects the strong-typed property. response.BirthDateRaw = "1998-05-08"; Assert.AreEqual("1998-05-08", response.BirthDateRaw); Assert.AreEqual(DateTime.Parse("May 8, 1998", CultureInfo.InvariantCulture), response.BirthDate); // Verify that an partial raw birthdate works, and sets the strong-typed property to null since it cannot be represented. response.BirthDateRaw = "2000-00-00"; Assert.AreEqual("2000-00-00", response.BirthDateRaw); Assert.IsFalse(response.BirthDate.HasValue); }
/// <summary> /// Tests equality of two <see cref="ClaimsResponse"/> objects. /// </summary> public override bool Equals(object obj) { ClaimsResponse other = obj as ClaimsResponse; if (other == null) { return(false); } return (safeEquals(this.BirthDate, other.BirthDate) && safeEquals(this.Country, other.Country) && safeEquals(this.Language, other.Language) && safeEquals(this.Email, other.Email) && safeEquals(this.FullName, other.FullName) && safeEquals(this.Gender, other.Gender) && safeEquals(this.Nickname, other.Nickname) && safeEquals(this.PostalCode, other.PostalCode) && safeEquals(this.TimeZone, other.TimeZone)); }
public void InvalidRawBirthdate() { var response = new ClaimsResponse(); response.BirthDateRaw = "2008"; }
public void EmptyMailAddress() { ClaimsResponse response = new ClaimsResponse(Constants.sreg_ns); response.Email = ""; Assert.IsNull(response.MailAddress); }
public void SetOpenIdProfileFields(ClaimsResponse value) { if (value == null) throw new ArgumentNullException("value"); DateOfBirth = value.BirthDate; countryDropdownList.SelectedValue = value.Country; emailTextBox.Text = value.Email; fullnameTextBox.Text = value.FullName; Gender = value.Gender; languageDropdownList.SelectedValue = value.Language; nicknameTextBox.Text = value.Nickname; postcodeTextBox.Text = value.PostalCode; timezoneDropdownList.SelectedValue = value.TimeZone; }
public static void Clear() { ProfileFields = null; FriendlyLoginName = null; }