From d83afd23b80d3431862063689ad08b37f3cdcb7a Mon Sep 17 00:00:00 2001 From: Josh Lozensky Date: Fri, 1 Dec 2023 14:16:08 -0800 Subject: [PATCH] removed equals and gethashcode --- .../ManagedIdentity/ManagedIdentityOptions.cs | 29 ++----------------- .../DownstreamApiTests.cs | 5 ++-- 2 files changed, 5 insertions(+), 29 deletions(-) diff --git a/src/Microsoft.Identity.Abstractions/ManagedIdentity/ManagedIdentityOptions.cs b/src/Microsoft.Identity.Abstractions/ManagedIdentity/ManagedIdentityOptions.cs index 784bd58..d6c8a83 100644 --- a/src/Microsoft.Identity.Abstractions/ManagedIdentity/ManagedIdentityOptions.cs +++ b/src/Microsoft.Identity.Abstractions/ManagedIdentity/ManagedIdentityOptions.cs @@ -33,34 +33,9 @@ public ManagedIdentityOptions Clone() { return new ManagedIdentityOptions { - ManagedIdentityType = this.ManagedIdentityType, - ClientId = this.ClientId + ManagedIdentityType = ManagedIdentityType, + ClientId = ClientId }; } - - /// - /// Ensures any object is equal if all fields hold the same values. - /// - /// - /// - public override bool Equals(object obj) - { - if (obj == null || GetType() != obj.GetType()) - { - return false; - } - ManagedIdentityOptions other = (ManagedIdentityOptions)obj; - return ManagedIdentityType == other.ManagedIdentityType && - ClientId == other.ClientId; - } - - /// - /// Returns the hash code for the instance based on the values of its fields. - /// - /// A 32-bit signed integer hash code. - public override int GetHashCode() - { - return new { ManagedIdentityType, ClientId }.GetHashCode(); - } } } diff --git a/test/Microsoft.Identity.Abstractions.Tests/DownstreamApiTests.cs b/test/Microsoft.Identity.Abstractions.Tests/DownstreamApiTests.cs index 48434b6..83dc124 100644 --- a/test/Microsoft.Identity.Abstractions.Tests/DownstreamApiTests.cs +++ b/test/Microsoft.Identity.Abstractions.Tests/DownstreamApiTests.cs @@ -76,7 +76,8 @@ public void CloneClonesAllProperties() Assert.Equal(downstreamApiOptions.AcquireTokenOptions.ExtraQueryParameters, downstreamApiClone.AcquireTokenOptions.ExtraQueryParameters); Assert.Equal(downstreamApiOptions.AcquireTokenOptions.ForceRefresh, downstreamApiClone.AcquireTokenOptions.ForceRefresh); Assert.Equal(downstreamApiOptions.AcquireTokenOptions.LongRunningWebApiSessionKey, downstreamApiClone.AcquireTokenOptions.LongRunningWebApiSessionKey); - Assert.Equal(downstreamApiOptions.AcquireTokenOptions.ManagedIdentity, downstreamApiClone.AcquireTokenOptions.ManagedIdentity); + Assert.Equal(downstreamApiOptions.AcquireTokenOptions.ManagedIdentity.ManagedIdentityType, downstreamApiClone.AcquireTokenOptions.ManagedIdentity.ManagedIdentityType); + Assert.Equal(downstreamApiOptions.AcquireTokenOptions.ManagedIdentity.ClientId, downstreamApiClone.AcquireTokenOptions.ManagedIdentity.ClientId); Assert.Equal(downstreamApiOptions.AcquireTokenOptions.PopPublicKey, downstreamApiClone.AcquireTokenOptions.PopPublicKey); Assert.Equal(downstreamApiOptions.AcquireTokenOptions.PopClaim, downstreamApiClone.AcquireTokenOptions.PopClaim); Assert.Equal(downstreamApiOptions.AcquireTokenOptions.Tenant, downstreamApiClone.AcquireTokenOptions.Tenant); @@ -154,4 +155,4 @@ public CustomAcquireTokenOptions() : base() { } public CustomAcquireTokenOptions(CustomAcquireTokenOptions other) : base(other) { } } -} \ No newline at end of file +}