public async Task AddScopeTestAsync() { const long newId = 1L; const string newScope = "scope.new"; await using (var context = NewContext()) { var service = new ScopeService(context); await service.AddScopeAsync(new Scope { UserId = newId, ScopeId = newScope }); await context.CommitAsync(); } await using (var context = NewContext()) { var service = new ScopeService(context); var result = await service.HasScopeAsync(newId, new [] { newScope }); Assert.True(result); } }
public async Task HasScopeTestAsync(long id, string scope, bool expected) { await using var context = NewContext(); var service = new ScopeService(context); bool hasScope = await service.HasScopeAsync(id, new [] { scope }); Assert.Equal(expected, hasScope); }