public async Task StaticProviderIsUsedFirst_Async() { // Arrange _staticMetadataProvider.GetMetadata("some_env.com").Returns(_expectedResult); // Act InstanceDiscoveryMetadataEntry actualResult1 = await _discoveryManager.GetMetadataEntryTryAvoidNetworkAsync( Authority, new[] { "env1", "env2" }, _testRequestContext) .ConfigureAwait(false); _staticMetadataProvider.Received(1).GetMetadata("some_env.com"); InstanceDiscoveryMetadataEntry actualResult2 = await _discoveryManager.GetMetadataEntryAsync( "https://some_env.com/tid", _testRequestContext) .ConfigureAwait(false); _staticMetadataProvider.Received(2).GetMetadata("some_env.com"); _staticMetadataProvider.AddMetadata(null, null); // Assert Assert.AreSame(_expectedResult, actualResult1, "The static provider should be queried first"); Assert.AreSame(_expectedResult, actualResult2, "The static provider should be queried first"); }
internal void AddTestValueToStaticProvider(string environment, InstanceDiscoveryMetadataEntry entry) { _staticMetadataProvider.AddMetadata(environment, entry); }