public async Task GetClientPropertyAsync() { using (var context = new IdentityServerConfigurationDbContext(_dbContextOptions, _storeOptions)) { var clientRepository = GetClientRepository(context); //Generate random new client without id var client = ClientMock.GenerateRandomClient(0); //Add new client await clientRepository.AddClientAsync(client); //Get new client var clientEntity = await clientRepository.GetClientAsync(client.Id); //Assert new client ClientAssert(clientEntity, client); //Generate random new Client Property var clientProperty = ClientMock.GenerateRandomClientProperty(0); //Add new client Property await clientRepository.AddClientPropertyAsync(clientEntity.Id, clientProperty); //Get new client Property var newClientProperty = await clientRepository.GetClientPropertyAsync(clientProperty.Id); newClientProperty.Should().BeEquivalentTo(clientProperty, options => options.Excluding(o => o.Id).Excluding(x => x.Client)); } }
public async Task AddClientPropertyAsync() { using (var context = new AdminDbContext(_dbContextOptions, _storeOptions, _operationalStore)) { IClientRepository clientRepository = new ClientRepository(context); //Generate random new client without id var client = ClientMock.GenerateRandomClient(0); //Add new client await clientRepository.AddClientAsync(client); //Get new client var clientEntity = await clientRepository.GetClientAsync(client.Id); //Assert new client clientEntity.Should().BeEquivalentTo(client, options => options.Excluding(o => o.Id)); //Generate random new Client property var clientProperty = ClientMock.GenerateRandomClientProperty(0); //Add new client property await clientRepository.AddClientPropertyAsync(clientEntity.Id, clientProperty); //Get new client property var newClientProperty = await context.ClientProperties.Where(x => x.Id == clientProperty.Id) .SingleOrDefaultAsync(); newClientProperty.Should().BeEquivalentTo(clientProperty, options => options.Excluding(o => o.Id).Excluding(x => x.Client)); } }
public async Task AddClientPropertyAsync() { IClientRepository clientRepository = new ClientDapperRepository(_configuration); //Generate random new client without id var client = ClientMock.GenerateRandomClient(); //Add new client var clientId = await clientRepository.AddClientAsync(client); //Get new client var clientEntity = await clientRepository.GetClientAsync(clientId); //Assert new client clientEntity.ShouldBeEquivalentTo(client, options => options.Excluding(o => o.Id) .Excluding(x => Regex.IsMatch(x.SelectedMemberPath, "AllowedGrantTypes\\[.+\\].Id")) .Excluding(x => Regex.IsMatch(x.SelectedMemberPath, "RedirectUris\\[.+\\].Id")) .Excluding(x => Regex.IsMatch(x.SelectedMemberPath, "PostLogoutRedirectUris\\[.+\\].Id")) .Excluding(x => Regex.IsMatch(x.SelectedMemberPath, "AllowedScopes\\[.+\\].Id")) .Excluding(x => Regex.IsMatch(x.SelectedMemberPath, "IdentityProviderRestrictions\\[.+\\].Id")) .Excluding(x => Regex.IsMatch(x.SelectedMemberPath, "AllowedCorsOrigins\\[.+\\].Id"))); //Generate random new Client property var clientProperty = ClientMock.GenerateRandomClientProperty(); //Add new client property var clientPropertyId = await clientRepository.AddClientPropertyAsync(clientEntity.Id, clientProperty); //Get new client property var newClientProperty = await clientRepository.GetClientPropertyAsync(clientPropertyId); newClientProperty.ShouldBeEquivalentTo(clientProperty, options => options.Excluding(o => o.Id).Excluding(x => x.Client)); }
public void CanMapClientPropertyToModel() { var clientProperty = ClientMock.GenerateRandomClientProperty(0); var clientPropertiesDto = clientProperty.ToModel(); //Assert clientPropertiesDto.Should().NotBeNull(); clientProperty.Should().BeEquivalentTo(clientPropertiesDto); }
public void CanMapClientPropertyToModel() { var clientProperty = ClientMock.GenerateRandomClientProperty(0); var clientPropertiesDto = clientProperty.ToModel(); //Assert clientPropertiesDto.Should().NotBeNull(); clientProperty.ShouldBeEquivalentTo(clientPropertiesDto, options => options.Excluding(o => o.Id) .Excluding(o => o.Client)); }
public async Task DeleteClientPropertyAsync() { using (var context = new IdentityServerConfigurationDbContext(_dbContextOptions, _storeOptions)) { var clientRepository = GetClientRepository(context); //Generate random new client without id var client = ClientMock.GenerateRandomClient(0); //Add new client await clientRepository.AddClientAsync(client); //Get new client var clientEntity = await clientRepository.GetClientAsync(client.Id); //Assert new client ClientAssert(clientEntity, client); //Generate random new Client Property var clientProperty = ClientMock.GenerateRandomClientProperty(0); //Add new client property await clientRepository.AddClientPropertyAsync(clientEntity.Id, clientProperty); //Get new client property var newClientProperties = await context.ClientProperties.Where(x => x.Id == clientProperty.Id) .SingleOrDefaultAsync(); //Assert newClientProperties.Should().BeEquivalentTo(clientProperty, options => options.Excluding(o => o.Id).Excluding(x => x.Client)); //Try delete it await clientRepository.DeleteClientPropertyAsync(newClientProperties); //Get new client property var deletedClientProperty = await context.ClientProperties.Where(x => x.Id == clientProperty.Id) .SingleOrDefaultAsync(); //Assert deletedClientProperty.Should().BeNull(); } }