コード例 #1
0
        public async Task GetIdentityResourceAsync()
        {
            using (var context = new ConfigurationDbContext(_dbContextOptions, _storeOptions, _operationalStore))
            {
                IIdentityResourceRepository identityResourceRepository = new IdentityResourceRepository(context);

                //Generate random new identity resource
                var identityResource = IdentityResourceMock.GenerateRandomIdentityResource(0);

                //Add new identity resource
                await identityResourceRepository.AddIdentityResourceAsync(identityResource);

                //Get new identity resource
                var newIdentityResource = await identityResourceRepository.GetIdentityResourceAsync(identityResource.Id);

                //Assert new identity resource
                newIdentityResource.ShouldBeEquivalentTo(identityResource, options => options.Excluding(o => o.Id));
            }
        }