public virtual void CanUpdateIdentityResourceScope() { using (var uow = DataService.StartUnitOfWork()) { var resource = new IdentityResourceEntity { Name = "openid", Description = "OpenId-Scope", DisplayName = "OpenId", Emphasize = true, Required = true, ShowInDiscoveryDocument = true }; uow.IdentityResourceRepository.Add(resource); var scope = new ScopeEntity { Name = "openid", Description = "OpenId-Scope", DisplayName = "OpenId", Emphasize = true, Required = true, ShowInDiscoveryDocument = true }; uow.ScopeRepository.Add(scope); var scope2 = new ScopeEntity { Name = "openid2", Description = "OpenId-Scope2", DisplayName = "OpenId2", Emphasize = true, Required = true, ShowInDiscoveryDocument = true }; uow.ScopeRepository.Add(scope2); var resourceScope = new IdentityResourceScopeEntity { IdentityResourceId = resource.Id, ScopeId = scope.Id }; uow.IdentityResourceScopeRepository.Add(resourceScope); resourceScope.ScopeId = scope2.Id; uow.IdentityResourceScopeRepository.Update(resourceScope); Assert.AreEqual(resourceScope.ScopeId, uow.IdentityResourceScopeRepository.Get(resourceScope.Id).ScopeId); } }
public virtual void CanGetByScopeNamesCompound() { using (var uow = DataService.StartUnitOfWork()) { var resource = new IdentityResourceEntity { Name = "openid", Description = "OpenId-Scope", DisplayName = "OpenId", Emphasize = true, Required = true, ShowInDiscoveryDocument = true }; uow.IdentityResourceRepository.Add(resource); var scope = new ScopeEntity { Name = "openid", Description = "OpenId-Scope", DisplayName = "OpenId", Emphasize = true, Required = true, ShowInDiscoveryDocument = true }; uow.ScopeRepository.Add(scope); var resourceScope = new IdentityResourceScopeEntity { IdentityResourceId = resource.Id, ScopeId = scope.Id }; uow.IdentityResourceScopeRepository.Add(resourceScope); Assert.AreEqual(resource.Name, uow.IdentityResourceRepository.GetByScopeNamesCompound(new[] { scope.Name }).First().IdentityResource .Name); } }