Skip to content

Commit 3b7040d

Browse files
bgavrilMSCopilot
andcommitted
Address PR feedback: add ExpectedUrl to instance discovery test mocks
Set ExpectedUrl on all instance discovery mock handlers to ensure the tests validate that the correct endpoint is called before verifying fallback/caching behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent ba6d2ee commit 3b7040d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

tests/Microsoft.Identity.Test.Unit/PublicApiTests/InstanceDiscoveryTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ public async Task InstanceDiscoveryFailure_IsCached_NotRetriedOnSubsequentCalls_
176176
httpManager.AddMockHandler(new MockHttpMessageHandler()
177177
{
178178
ExpectedMethod = HttpMethod.Get,
179+
ExpectedUrl = "https://login.microsoftonline.com/common/discovery/instance",
179180
ResponseMessage = new HttpResponseMessage(errorStatusCode)
180181
{
181182
Content = new StringContent("error")
@@ -231,6 +232,7 @@ public async Task InstanceDiscoveryTimeout_FallsBackAndCachesResult_Async()
231232
httpManager.AddMockHandler(new MockHttpMessageHandler()
232233
{
233234
ExpectedMethod = HttpMethod.Get,
235+
ExpectedUrl = "https://login.microsoftonline.com/common/discovery/instance",
234236
ExceptionToThrow = new TaskCanceledException("simulated timeout")
235237
});
236238
httpManager.AddMockHandlerSuccessfulClientCredentialTokenResponseMessage();
@@ -277,6 +279,7 @@ public async Task InstanceDiscoveryCallerCancellation_BubblesUp_DoesNotFallBack_
277279
httpManager.AddMockHandler(new MockHttpMessageHandler()
278280
{
279281
ExpectedMethod = HttpMethod.Get,
282+
ExpectedUrl = "https://login.microsoftonline.com/common/discovery/instance",
280283
ResponseMessage = new HttpResponseMessage(HttpStatusCode.OK)
281284
{
282285
Content = new StringContent("{}")

0 commit comments

Comments
 (0)