1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-28 13:15:12 +01:00
bitwarden-server/test/Infrastructure.EFIntegration.Test/AdminConsole/Repositories/EqualityComparers/OrganizationUserPolicyDetailsCompare.cs
Thomas Rittson 09d07d864e
[AC-1751] AC Team code ownership moves: OrganizationUser (part 1) (#3487)
* Move OrganizationUser domain to AC Team ownership

* Namespaces will be updated in a separate commit
2023-11-30 07:04:56 +10:00

44 lines
1.4 KiB
C#

using Bit.Core.Models.Data.Organizations.OrganizationUsers;
namespace Bit.Infrastructure.EFIntegration.Test.Repositories.EqualityComparers;
public class OrganizationUserPolicyDetailsCompare : IEqualityComparer<OrganizationUserPolicyDetails>
{
public bool Equals(OrganizationUserPolicyDetails x, OrganizationUserPolicyDetails y)
{
if (ReferenceEquals(x, y))
{
return true;
}
if (ReferenceEquals(x, null))
{
return false;
}
if (ReferenceEquals(y, null))
{
return false;
}
if (x.GetType() != y.GetType())
{
return false;
}
return x.OrganizationId.Equals(y.OrganizationId) &&
x.PolicyType == y.PolicyType &&
x.PolicyEnabled == y.PolicyEnabled &&
x.PolicyData == y.PolicyData &&
x.OrganizationUserType == y.OrganizationUserType &&
x.OrganizationUserStatus == y.OrganizationUserStatus &&
x.OrganizationUserPermissionsData == y.OrganizationUserPermissionsData &&
x.IsProvider == y.IsProvider;
}
public int GetHashCode(OrganizationUserPolicyDetails obj)
{
return HashCode.Combine(obj.OrganizationId, (int)obj.PolicyType, obj.PolicyEnabled, obj.PolicyData, (int)obj.OrganizationUserType, (int)obj.OrganizationUserStatus, obj.OrganizationUserPermissionsData, obj.IsProvider);
}
}