예제 #1
0
        /// <summary>
        /// Returns true if Role instances are equal
        /// </summary>
        /// <param name="other">Instance of Role to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Role other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     RoleName == other.RoleName ||
                     RoleName != null &&
                     RoleName.Equals(other.RoleName)
                 ) &&
                 (
                     CreateDate == other.CreateDate ||
                     CreateDate != null &&
                     CreateDate.Equals(other.CreateDate)
                 ) &&
                 (
                     Identities == other.Identities ||
                     Identities != null &&
                     Identities.Equals(other.Identities)
                 ));
        }
예제 #2
0
        // The following methods support the delta reports
        public bool Equals([AllowNull] UserRoleAllDTO other)
        {
            // Check whether the compared object is null.
            if (other is null)
            {
                return(false);
            }

            // Check whether the compared object references the same data.
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            // Check whether the objects’ properties are equal.
            return(UserId.Equals(other.UserId) &&
                   UserFullName.Equals(other.UserFullName) &&

                   RoleId.Equals(other.RoleId) &&
                   RoleName.Equals(other.RoleName) &&
                   RoleDescription.Equals(other.RoleDescription) &&
                   RoleOwner_RoleId.Equals(other.RoleOwner_RoleId) &&

                   LastCertifiedBy.Equals(other.LastCertifiedBy) &&
                   LastCertifiedDate.Equals(other.LastCertifiedDate));
        }
        // The following methods support the delta reports

        // Handle equals for everything but the managers / service owners isCertified and the
        // risk rating. The isCertified stuff gets reset everytime a new cycle happens and
        // risk rating is calculated from threat and likelihood ratings so we can ignore those
        public bool Equals([AllowNull] RoleServicePrivAllDTO other)
        {
            // Check whether the compared object is null.
            if (other is null)
            {
                return(false);
            }

            // Check whether the compared object references the same data.
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            // Check whether the objects’ properties are equal.
            // Role stuff
            return(RolePrivId.Equals(other.RolePrivId) &&
                   RoleId.Equals(other.RoleId) &&
                   RoleName.Equals(other.RoleName) &&
                   RoleDescription.Equals(other.RoleDescription) &&
                   RoleOwner_RoleId.Equals(other.RoleOwner_RoleId) &&

                   // Manager stuff
                   RoleOwner_PrivId.Equals(other.RoleOwner_PrivId) &&
                   RoleOwner_PermissionGroup.Equals(other.RoleOwner_PermissionGroup) &&
                   RoleOwner_ServicePrivSummary.Equals(other.RoleOwner_ServicePrivSummary) &&
                   RoleOwner_CredentialStorageMethod.Equals(other.RoleOwner_CredentialStorageMethod) &&
                   RoleOwner_ServiceId.Equals(other.RoleOwner_ServiceId) &&
                   RoleOwner_ServiceName.Equals(other.RoleOwner_ServiceName) &&
                   RoleOwner_ServiceDescription.Equals(other.RoleOwner_ServiceDescription) &&

                   RoleOwner_RoleAccessJustification.Equals(other.RoleOwner_RoleAccessJustification) &&
                   RoleOwner_RemovalImpact.Equals(other.RoleOwner_RemovalImpact) &&
                   RoleOwner_IsRevoked.Equals(other.RoleOwner_IsRevoked) &&
                   RoleOwner_DateCertified.Equals(other.RoleOwner_DateCertified));/* &&
                                                                                   *
                                                                                   * // Service Owner Stuff
                                                                                   * ServiceOwner_PrivId.Equals(other.ServiceOwner_PrivId) &&
                                                                                   * ServiceOwner_PermissionGroup.Equals(other.ServiceOwner_PermissionGroup) &&
                                                                                   * ServiceOwner_ServicePrivSummary.Equals(other.ServiceOwner_ServicePrivSummary) &&
                                                                                   * ServiceOwner_CredentialStorageMethod.Equals(other.ServiceOwner_CredentialStorageMethod) &&
                                                                                   * ServiceOwner_ServiceId.Equals(other.ServiceOwner_ServiceId) &&
                                                                                   * ServiceOwner_ServiceName.Equals(other.ServiceOwner_ServiceName) &&
                                                                                   * ServiceOwner_ServiceDescription.Equals(other.ServiceOwner_ServiceDescription) &&
                                                                                   *
                                                                                   * ServiceOwner_RoleAccessJustification.Equals(other.ServiceOwner_RoleAccessJustification) &&
                                                                                   * ServiceOwner_RemovalImpact.Equals(other.ServiceOwner_RemovalImpact) &&
                                                                                   * ServiceOwner_IsRevoked.Equals(other.ServiceOwner_IsRevoked) &&
                                                                                   * ServiceOwner_DateCertified.Equals(other.ServiceOwner_DateCertified) &&
                                                                                   *
                                                                                   * // Risk stuff
                                                                                   * RiskImpact.Equals(other.RiskImpact) &&
                                                                                   * RiskLikelihood.Equals(other.RiskLikelihood) &&
                                                                                   * RiskNotes.Equals(other.RiskNotes) &&
                                                                                   * RiskAssessmentDate.Equals(other.RiskAssessmentDate);*/
        }
예제 #4
0
        /// <summary>
        /// Определяет, равны ли значения этого экземпляра и указанного объекта MainRepository.Models.RoleModel.
        /// </summary>
        /// <param name="obj">Объект для сравнения с данным экземпляром.</param>
        /// <returns>true, если значение параметра obj совпадает со значением данного экземпляра;
        /// в противном случае — false. Если значением параметра obj является null, метод возвращает false.</returns>
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return false;
            }

            var roleModel = obj as RoleModel;

            return RoleName.Equals(roleModel.RoleName);
        }
예제 #5
0
        /// <summary>
        /// Returns true if Employee instances are equal
        /// </summary>
        /// <param name="other">Instance of Employee to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Employee other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     ContractTypeName == other.ContractTypeName ||
                     ContractTypeName != null &&
                     ContractTypeName.Equals(other.ContractTypeName)
                 ) &&
                 (
                     RoleId == other.RoleId ||
                     RoleId != null &&
                     RoleId.Equals(other.RoleId)
                 ) &&
                 (
                     RoleName == other.RoleName ||
                     RoleName != null &&
                     RoleName.Equals(other.RoleName)
                 ) &&
                 (
                     RoleDescription == other.RoleDescription ||
                     RoleDescription != null &&
                     RoleDescription.Equals(other.RoleDescription)
                 ) &&
                 (
                     HourlySalary == other.HourlySalary ||
                     HourlySalary != null &&
                     HourlySalary.Equals(other.HourlySalary)
                 ) &&
                 (
                     MonthlySalary == other.MonthlySalary ||
                     MonthlySalary != null &&
                     MonthlySalary.Equals(other.MonthlySalary)
                 ));
        }
예제 #6
0
 public bool Equals(MembershipRole other)
 {
     if (Object.ReferenceEquals(other, null))
     {
         return(false);
     }
     if (Object.ReferenceEquals(this, other))
     {
         return(true);
     }
     return(RoleName.Equals(other.RoleName) && RoleId.Equals(other.RoleId));
 }
예제 #7
0
        private void VerifyProxyMsg(RoleName oldest, RoleName proxyNode, int msg)
        {
            EnterBarrier("before-" + msg + "-proxy-verified");

            // send message to the proxy
            RunOn(() =>
            {
                // make sure that the proxy has received membership changes
                // and points to the current singleton
                var p             = CreateTestProbe();
                var oldestAddress = Node(oldest).Address;
                Within(TimeSpan.FromSeconds(10), () =>
                {
                    AwaitAssert(() =>
                    {
                        Sys.ActorSelection("/user/consumerProxy").Tell(Consumer.Ping.Instance, p.Ref);
                        p.ExpectMsg <Consumer.Pong>(TimeSpan.FromSeconds(1));
                        var replyFromAddress = p.LastSender.Path.Address;
                        if (oldest.Equals(proxyNode))
                        {
                            replyFromAddress.HasLocalScope.Should().BeTrue();
                        }
                        else
                        {
                            replyFromAddress.Should().Be(oldestAddress);
                        }
                    });
                });

                // send a real message
                Sys.ActorSelection("/user/consumerProxy").Tell(msg);
            }, proxyNode);

            EnterBarrier($"sent-msg-{msg}");

            // expect a message on the oldest node
            RunOn(() =>
            {
                ExpectMsg(msg);
            }, oldest);

            EnterBarrier("after-" + msg + "-proxy-verified");
        }
예제 #8
0
파일: Role.cs 프로젝트: obarlik/Services
 public override bool Equals(object obj)
 {
     return(RoleName.Equals(
                obj.ToString(),
                StringComparison.InvariantCultureIgnoreCase));
 }