public void EnsureUniqueApiResourceScopeNames_LogsNoErrorForNoApiResource() { var apiResources = new List <ApiResource>(); DuplicateScopeFilteringInMemoryResourcesStore .EnsureUniqueApiResourceScopeNames(apiResources, _loggerMock.Object, new List <IdentityResource>()).ToList(); _loggerMock.VerifyLog(LogLevel.Error, Times.Never()); }
public void EnsureUniqueApiResourceScopeNames_LogsNoErrorForSingleApiResourceWithSingleScope() { var apiResources = new List <ApiResource> { new ApiResource { Scopes = { new Scope { Name = "scope1" } } } }; DuplicateScopeFilteringInMemoryResourcesStore .EnsureUniqueApiResourceScopeNames(apiResources, _loggerMock.Object, new List <IdentityResource>()).ToList(); _loggerMock.VerifyLog(LogLevel.Error, Times.Never()); }
public void EnsureUniqueApiResourceScopeNames_LogsErrorWhenApiResourceHasSameScopeNameAsIdentityResource() { var apiResources = new List <ApiResource> { new ApiResource { Scopes = { new Scope { Name = "scope1" } } }, new ApiResource { Scopes = { new Scope { Name = "scope2" } } } }; DuplicateScopeFilteringInMemoryResourcesStore .EnsureUniqueApiResourceScopeNames(apiResources, _loggerMock.Object, new List <IdentityResource> { new IdentityResource("scope1", new[] { "" }) }).ToList(); _loggerMock.VerifyLog(LogLevel.Error, Times.Once()); }
public void EnsureUniqueApiResourceScopeNames_ReturnsOnlyApiResourcesWithDistinctNames() { var apiResources = new List <ApiResource> { new ApiResource { Scopes = { new Scope { Name = "scope1" } } }, new ApiResource("ApiResource1") { Scopes = { new Scope { Name = "scope1" }, new Scope{ Name = "scope3" }, new Scope{ Name = "scope3" } } } }; var result = DuplicateScopeFilteringInMemoryResourcesStore .EnsureUniqueApiResourceScopeNames(apiResources, _loggerMock.Object, new List <IdentityResource>()).ToList(); result.Should().BeEquivalentTo(new List <ApiResource> { new ApiResource { Scopes = { new Scope { Name = "scope1" } } }, new ApiResource("ApiResource1") { Scopes = { new Scope { Name = "scope3" } } } }); }
public void EnsureUniqueApiResourceScopeNames_LogsErrorsForApiResourcesWithDuplicateScopeNames() { var apiResources = new List <ApiResource> { new ApiResource { Scopes = { new Scope { Name = "scope1" } } }, new ApiResource("scope1") { Scopes = { new Scope { Name = "scope3" }, new Scope{ Name = "scope3" } } } }; DuplicateScopeFilteringInMemoryResourcesStore .EnsureUniqueApiResourceScopeNames(apiResources, _loggerMock.Object, new List <IdentityResource>()).ToList(); _loggerMock.VerifyLog(LogLevel.Error, Times.Exactly(2)); }