Пример #1
0
        public void Equals_returns_false_for_different_values()
        {
            // Arrange

            var sut   = new OrganizationName(Guid.NewGuid().ToString());
            var other = new OrganizationName(Guid.NewGuid().ToString());

            // Act

            var result = sut.Equals(other);

            // Assert

            result.ShouldBeFalse();
        }
Пример #2
0
        public void Equals_returns_true_for_same_value()
        {
            // Arrange

            var name  = Guid.NewGuid().ToString();
            var sut   = new OrganizationName(name);
            var other = new OrganizationName(name);

            // Act

            var result = sut.Equals(other);

            // Assert

            result.ShouldBeTrue();
        }
Пример #3
0
        /// <summary>
        /// Returns true if Owner instances are equal
        /// </summary>
        /// <param name="other">Instance of Owner to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OwnerViewModel other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id.Equals(other.Id)
                     ) &&
                 (
                     OwnerCode == other.OwnerCode ||
                     OwnerCode != null &&
                     OwnerCode.Equals(other.OwnerCode)
                 ) &&
                 (
                     OrganizationName == other.OrganizationName ||
                     OrganizationName != null &&
                     OrganizationName.Equals(other.OrganizationName)
                 ) &&
                 (
                     LocalAreaName == other.LocalAreaName ||
                     LocalAreaName != null &&
                     LocalAreaName.Equals(other.LocalAreaName)
                 ) &&
                 (
                     PrimaryContactName == other.PrimaryContactName ||
                     PrimaryContactName != null &&
                     PrimaryContactName.Equals(other.PrimaryContactName)
                 ) &&
                 (
                     EquipmentCount == other.EquipmentCount ||
                     EquipmentCount.Equals(other.EquipmentCount)
                 ) &&
                 (
                     Status == other.Status ||
                     Status != null &&
                     Status.Equals(other.Status)
                 ));
        }
Пример #4
0
        /// <summary>
        /// Returns true if Owner instances are equal
        /// </summary>
        /// <param name="other">Instance of Owner to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Owner other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id.Equals(other.Id)
                     ) &&
                 (
                     OwnerEquipmentCodePrefix == other.OwnerEquipmentCodePrefix ||
                     OwnerEquipmentCodePrefix != null &&
                     OwnerEquipmentCodePrefix.Equals(other.OwnerEquipmentCodePrefix)
                 ) &&
                 (
                     OrganizationName == other.OrganizationName ||
                     OrganizationName != null &&
                     OrganizationName.Equals(other.OrganizationName)
                 ) &&
                 (
                     MeetsResidency == other.MeetsResidency ||
                     MeetsResidency.Equals(other.MeetsResidency)
                 ) &&
                 (
                     LocalArea == other.LocalArea ||
                     LocalArea != null &&
                     LocalArea.Equals(other.LocalArea)
                 ) &&
                 (
                     Status == other.Status ||
                     Status != null &&
                     Status.Equals(other.Status)
                 ) &&
                 (
                     DoingBusinessAs == other.DoingBusinessAs ||
                     DoingBusinessAs != null &&
                     DoingBusinessAs.Equals(other.DoingBusinessAs)
                 ) &&
                 (
                     RegisteredCompanyNumber == other.RegisteredCompanyNumber ||
                     RegisteredCompanyNumber != null &&
                     RegisteredCompanyNumber.Equals(other.RegisteredCompanyNumber)
                 ) &&
                 (
                     PrimaryContact == other.PrimaryContact ||
                     PrimaryContact != null &&
                     PrimaryContact.Equals(other.PrimaryContact)
                 ) &&
                 (
                     IsMaintenanceContractor == other.IsMaintenanceContractor ||
                     IsMaintenanceContractor != null &&
                     IsMaintenanceContractor.Equals(other.IsMaintenanceContractor)
                 ) &&
                 (
                     WorkSafeBCPolicyNumber == other.WorkSafeBCPolicyNumber ||
                     WorkSafeBCPolicyNumber != null &&
                     WorkSafeBCPolicyNumber.Equals(other.WorkSafeBCPolicyNumber)
                 ) &&
                 (
                     WorkSafeBCExpiryDate == other.WorkSafeBCExpiryDate ||
                     WorkSafeBCExpiryDate != null &&
                     WorkSafeBCExpiryDate.Equals(other.WorkSafeBCExpiryDate)
                 ) &&
                 (
                     CGLEndDate == other.CGLEndDate ||
                     CGLEndDate != null &&
                     CGLEndDate.Equals(other.CGLEndDate)
                 ) &&
                 (
                     ArchiveCode == other.ArchiveCode ||
                     ArchiveCode != null &&
                     ArchiveCode.Equals(other.ArchiveCode)
                 ) &&
                 (
                     ArchiveReason == other.ArchiveReason ||
                     ArchiveReason != null &&
                     ArchiveReason.Equals(other.ArchiveReason)
                 ) &&
                 (
                     ArchiveDate == other.ArchiveDate ||
                     ArchiveDate != null &&
                     ArchiveDate.Equals(other.ArchiveDate)
                 ) &&
                 (
                     Contacts == other.Contacts ||
                     Contacts != null &&
                     Contacts.SequenceEqual(other.Contacts)
                 ) &&
                 (
                     Notes == other.Notes ||
                     Notes != null &&
                     Notes.SequenceEqual(other.Notes)
                 ) &&
                 (
                     Attachments == other.Attachments ||
                     Attachments != null &&
                     Attachments.SequenceEqual(other.Attachments)
                 ) &&
                 (
                     History == other.History ||
                     History != null &&
                     History.SequenceEqual(other.History)
                 ) &&
                 (
                     EquipmentList == other.EquipmentList ||
                     EquipmentList != null &&
                     EquipmentList.SequenceEqual(other.EquipmentList)
                 ));
        }
Пример #5
0
        /// <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)
                 ));
        }
Пример #6
0
 public bool IsUnknown()
 {
     return(!String.IsNullOrWhiteSpace(OrganizationName) &&
            OrganizationName.Equals(OrganizationUnknown, StringComparison.InvariantCultureIgnoreCase));
 }
Пример #7
0
            public override bool Equals(object obj)
            {
                var other = obj as Configuration;

                if (other == null)
                {
                    return(false);
                }

                if (!ServerAddress.Equals(other.ServerAddress, StringComparison.InvariantCultureIgnoreCase))
                {
                    return(false);
                }

                if (!OrganizationName.Equals(other.OrganizationName, StringComparison.InvariantCultureIgnoreCase))
                {
                    return(false);
                }

                if (EndpointType != other.EndpointType)
                {
                    return(false);
                }

                if (Credentials == null || other.Credentials == null)
                {
                    return(true);
                }

                switch (EndpointType)
                {
                case AuthenticationProviderType.ActiveDirectory:
                    if (!Credentials.Windows.ClientCredential.Domain.Equals(other.Credentials.Windows.ClientCredential.Domain, StringComparison.InvariantCultureIgnoreCase))
                    {
                        return(false);
                    }

                    if (!Credentials.Windows.ClientCredential.UserName.Equals(other.Credentials.Windows.ClientCredential.UserName, StringComparison.InvariantCultureIgnoreCase))
                    {
                        return(false);
                    }

                    return(true);

                case AuthenticationProviderType.LiveId:
                    if (!Credentials.UserName.UserName.Equals(other.Credentials.UserName.UserName, StringComparison.InvariantCultureIgnoreCase))
                    {
                        return(false);
                    }

                    if (!DeviceCredentials.UserName.UserName.Equals(other.DeviceCredentials.UserName.UserName, StringComparison.InvariantCultureIgnoreCase))
                    {
                        return(false);
                    }

                    if (!DeviceCredentials.UserName.Password.Equals(other.DeviceCredentials.UserName.Password, StringComparison.InvariantCultureIgnoreCase))
                    {
                        return(false);
                    }

                    return(true);

                case AuthenticationProviderType.None:
                case AuthenticationProviderType.Federation:
                case AuthenticationProviderType.OnlineFederation:
                    return(Credentials.UserName.UserName.Equals(other.Credentials.UserName.UserName, StringComparison.InvariantCultureIgnoreCase));

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }