Beispiel #1
0
        public void EnsureUniqueIndentityScopeNames_LogsNoErrorForNoIdentityResource()
        {
            var identityResources = new List <IdentityResource>();

            DuplicateScopeFilteringInMemoryResourcesStore
            .EnsureUniqueIndentityScopeNames(identityResources, _loggerMock.Object, new List <ApiResource>()).ToList();
            _loggerMock.VerifyLog(LogLevel.Error, Times.Never());
        }
Beispiel #2
0
        public void EnsureUniqueIndentityScopeNames_LogsNoErrorForIdentityResourcesWithDistinctNames()
        {
            var identityResource1 = new IdentityResource("IdentityResource1", new[] { "" });
            var identityResource2 = new IdentityResource("IdentityResource2", new[] { "" });
            var identityResources = new List <IdentityResource> {
                identityResource1, identityResource2
            };

            DuplicateScopeFilteringInMemoryResourcesStore
            .EnsureUniqueIndentityScopeNames(identityResources, _loggerMock.Object, new List <ApiResource>()).ToList();
            _loggerMock.VerifyLog(LogLevel.Error, Times.Never());
        }
Beispiel #3
0
        public void EnsureUniqueIndentityScopeNames_ReturnsOnlyIdentityResourcesWithDistinctNames()
        {
            var identityResource1 = new IdentityResource("IdentityResource1", new[] { "" });
            var identityResource2 = new IdentityResource("IdentityResource1", new[] { "" });
            var identityResource3 = new IdentityResource("IdentityResource3", new[] { "" });
            var identityResources = new List <IdentityResource> {
                identityResource1, identityResource2, identityResource3
            };

            var result = DuplicateScopeFilteringInMemoryResourcesStore
                         .EnsureUniqueIndentityScopeNames(identityResources, _loggerMock.Object, new List <ApiResource>()).ToList();

            result.Select(r => r.Name).Should().OnlyHaveUniqueItems();
        }
Beispiel #4
0
        public void EnsureUniqueIndentityScopeNames_LogsErrorWhenApiResourceHasSameScopeNameAsIdentityResource()
        {
            var identityResource1 = new IdentityResource("scope1", new[] { "" });
            var identityResource2 = new IdentityResource("scope2", new[] { "" });
            var identityResources = new List <IdentityResource> {
                identityResource1, identityResource2
            };

            var apiResources = new List <ApiResource> {
                new ApiResource {
                    Scopes = { new Scope {
                                   Name = "scope1"
                               } }
                }
            };

            DuplicateScopeFilteringInMemoryResourcesStore
            .EnsureUniqueIndentityScopeNames(identityResources, _loggerMock.Object, apiResources).ToList();
            _loggerMock.VerifyLog(LogLevel.Error, Times.Once());
        }