-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
30d6a43
commit 281c134
Showing
8 changed files
with
155 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
test/Microsoft.Azure.SignalR.Common.Tests/Auth/AccessKeySynchronizerFacts.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
using Azure.Identity; | ||
using Microsoft.Azure.SignalR.Tests.Common; | ||
using Microsoft.Extensions.Logging.Abstractions; | ||
using Xunit; | ||
|
||
namespace Microsoft.Azure.SignalR.Common.Tests.Auth; | ||
|
||
public class AccessKeySynchronizerFacts | ||
{ | ||
[Fact] | ||
public void AddAndRemoveServiceEndpointsTest() | ||
{ | ||
var synchronizer = GetInstanceForTest(); | ||
|
||
var credential = new DefaultAzureCredential(); | ||
var endpoint1 = new TestServiceEndpoint(credential); | ||
var endpoint2 = new TestServiceEndpoint(credential); | ||
|
||
Assert.Equal(0, synchronizer.Count()); | ||
synchronizer.UpdateServiceEndpoints([endpoint1]); | ||
Assert.Equal(1, synchronizer.Count()); | ||
synchronizer.UpdateServiceEndpoints([endpoint1, endpoint2]); | ||
Assert.Empty(synchronizer.InitializedKeyList); | ||
|
||
Assert.Equal(2, synchronizer.Count()); | ||
Assert.True(synchronizer.ContainsKey(endpoint1)); | ||
Assert.True(synchronizer.ContainsKey(endpoint2)); | ||
|
||
synchronizer.UpdateServiceEndpoints([endpoint2]); | ||
Assert.Equal(1, synchronizer.Count()); | ||
synchronizer.UpdateServiceEndpoints([]); | ||
Assert.Equal(0, synchronizer.Count()); | ||
Assert.Empty(synchronizer.InitializedKeyList); | ||
} | ||
|
||
private static AccessKeySynchronizer GetInstanceForTest() | ||
{ | ||
return new AccessKeySynchronizer(NullLoggerFactory.Instance, false); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.