public bool Parse(string src) { var dest = new SoftwareVersion(src); var cmp = new SoftwareVersion(src); Assert.That(dest, Is.EqualTo(cmp)); Assert.That(dest, Is.Not.EqualTo(src)); Assert.That(dest, Is.Not.EqualTo(default(SoftwareVersion))); Assert.That(dest.GetHashCode(), Is.EqualTo(cmp.GetHashCode())); return(dest.ToString() == src); }
/// <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 (DataCustodianId != null) { hashCode = hashCode * 59 + DataCustodianId.GetHashCode(); } if (DataCustodianApplicationStatus != null) { hashCode = hashCode * 59 + DataCustodianApplicationStatus.GetHashCode(); } if (ThirdPartyApplicationDescription != null) { hashCode = hashCode * 59 + ThirdPartyApplicationDescription.GetHashCode(); } if (ThirdPartyApplicationStatus != null) { hashCode = hashCode * 59 + ThirdPartyApplicationStatus.GetHashCode(); } if (ThirdPartyApplicationType != null) { hashCode = hashCode * 59 + ThirdPartyApplicationType.GetHashCode(); } if (ThirdPartyApplicationUse != null) { hashCode = hashCode * 59 + ThirdPartyApplicationUse.GetHashCode(); } if (ThirdPartyPhone != null) { hashCode = hashCode * 59 + ThirdPartyPhone.GetHashCode(); } if (AuthorizationServerUri != null) { hashCode = hashCode * 59 + AuthorizationServerUri.GetHashCode(); } if (ThirdPartyNotifyUri != null) { hashCode = hashCode * 59 + ThirdPartyNotifyUri.GetHashCode(); } if (AuthorizationServerAuthorizationEndpoint != null) { hashCode = hashCode * 59 + AuthorizationServerAuthorizationEndpoint.GetHashCode(); } if (AuthorizationServerRegistrationEndpoint != null) { hashCode = hashCode * 59 + AuthorizationServerRegistrationEndpoint.GetHashCode(); } if (AuthorizationServerTokenEndpoint != null) { hashCode = hashCode * 59 + AuthorizationServerTokenEndpoint.GetHashCode(); } if (DataCustodianBulkRequestURI != null) { hashCode = hashCode * 59 + DataCustodianBulkRequestURI.GetHashCode(); } if (DataCustodianResourceEndpoint != null) { hashCode = hashCode * 59 + DataCustodianResourceEndpoint.GetHashCode(); } if (ThirdPartyScopeSelectionURI != null) { hashCode = hashCode * 59 + ThirdPartyScopeSelectionURI.GetHashCode(); } if (ThirdPartyUserPortalScreenURI != null) { hashCode = hashCode * 59 + ThirdPartyUserPortalScreenURI.GetHashCode(); } if (ClientSecret != null) { hashCode = hashCode * 59 + ClientSecret.GetHashCode(); } if (LogoUri != null) { hashCode = hashCode * 59 + LogoUri.GetHashCode(); } if (ClientName != null) { hashCode = hashCode * 59 + ClientName.GetHashCode(); } if (ClientUri != null) { hashCode = hashCode * 59 + ClientUri.GetHashCode(); } if (RedirectUri != null) { hashCode = hashCode * 59 + RedirectUri.GetHashCode(); } if (ClientId != null) { hashCode = hashCode * 59 + ClientId.GetHashCode(); } if (TosUri != null) { hashCode = hashCode * 59 + TosUri.GetHashCode(); } if (PolicyUri != null) { hashCode = hashCode * 59 + PolicyUri.GetHashCode(); } if (SoftwareId != null) { hashCode = hashCode * 59 + SoftwareId.GetHashCode(); } if (SoftwareVersion != null) { hashCode = hashCode * 59 + SoftwareVersion.GetHashCode(); } if (ClientIdIssuedAt != null) { hashCode = hashCode * 59 + ClientIdIssuedAt.GetHashCode(); } if (ClientSecretExpiresAt != null) { hashCode = hashCode * 59 + ClientSecretExpiresAt.GetHashCode(); } if (Contacts != null) { hashCode = hashCode * 59 + Contacts.GetHashCode(); } if (TokenEndpointAuthMethod != null) { hashCode = hashCode * 59 + TokenEndpointAuthMethod.GetHashCode(); } if (Scope != null) { hashCode = hashCode * 59 + Scope.GetHashCode(); } if (GrantTypes != null) { hashCode = hashCode * 59 + GrantTypes.GetHashCode(); } if (ResponseTypes != null) { hashCode = hashCode * 59 + ResponseTypes.GetHashCode(); } if (RegistrationClientUri != null) { hashCode = hashCode * 59 + RegistrationClientUri.GetHashCode(); } if (RegistrationAccessToken != null) { hashCode = hashCode * 59 + RegistrationAccessToken.GetHashCode(); } if (DataCustodianScopeSelectionScreenURI != null) { hashCode = hashCode * 59 + DataCustodianScopeSelectionScreenURI.GetHashCode(); } return(hashCode); } }
public override int GetHashCode() { return((SystemId.GetHashCode() * 397) ^ (DataFormatVersion.GetHashCode() * 397) ^ (SoftwareVersion.GetHashCode() * 397) ^ (MachineName.GetHashCode() * 397) ^ (MacAddress.GetHashCode() * 397) ^ (IPAddress.GetHashCode() * 397)); }