mirror of https://github.com/abpframework/abp.git
7 changed files with 107 additions and 7 deletions
@ -0,0 +1,11 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Volo.Abp.IdentityServer |
||||
|
{ |
||||
|
public class PersistentGrantRepository_Tests : PersistentGrantRepository_Tests<AbpIdentityServerTestEntityFrameworkCoreModule> |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace Volo.Abp.IdentityServer |
||||
|
{ |
||||
|
public class PersistentGrantRepository_Tests : PersistentGrantRepository_Tests<AbpIdentityServerMongoDbTestModule> |
||||
|
{ |
||||
|
|
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,62 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
using System.Threading.Tasks; |
||||
|
using Shouldly; |
||||
|
using Volo.Abp.IdentityServer.Grants; |
||||
|
using Volo.Abp.Modularity; |
||||
|
using Xunit; |
||||
|
|
||||
|
namespace Volo.Abp.IdentityServer |
||||
|
{ |
||||
|
public abstract class PersistentGrantRepository_Tests<TStartupModule> : AbpIdentityServerTestBase<TStartupModule> |
||||
|
where TStartupModule : IAbpModule |
||||
|
{ |
||||
|
private readonly IPersistentGrantRepository _persistentGrantRepository; |
||||
|
|
||||
|
protected PersistentGrantRepository_Tests() |
||||
|
{ |
||||
|
_persistentGrantRepository = GetRequiredService<IPersistentGrantRepository>(); |
||||
|
} |
||||
|
|
||||
|
[Fact] |
||||
|
public async Task FindByKeyAsync() |
||||
|
{ |
||||
|
(await _persistentGrantRepository.FindByKeyAsync("PersistedGrantKey1")).ShouldNotBeNull(); |
||||
|
} |
||||
|
|
||||
|
[Fact] |
||||
|
public async Task GetListBySubjectIdAsync() |
||||
|
{ |
||||
|
var persistedGrants = await _persistentGrantRepository.GetListBySubjectIdAsync("PersistedGrantSubjectId1"); |
||||
|
persistedGrants.ShouldNotBeEmpty(); |
||||
|
persistedGrants.ShouldContain(x => x.Key == "PersistedGrantKey1"); |
||||
|
} |
||||
|
|
||||
|
[Fact] |
||||
|
public async Task DeleteBySubjectIdAndClientId() |
||||
|
{ |
||||
|
await _persistentGrantRepository.DeleteAsync("PersistedGrantSubjectId1", "PersistedGrantClientId1"); |
||||
|
|
||||
|
var persistedGrants = await _persistentGrantRepository.GetListAsync(); |
||||
|
persistedGrants.ShouldNotBeEmpty(); |
||||
|
persistedGrants.ShouldNotContain(x => |
||||
|
x.Key == "PersistedGrantKey1" && x.SubjectId == "PersistedGrantSubjectId1" && |
||||
|
x.ClientId == "PersistedGrantClientId1"); |
||||
|
} |
||||
|
|
||||
|
[Fact] |
||||
|
public async Task DeleteBySubjectIdAndClientIdAndType() |
||||
|
{ |
||||
|
await _persistentGrantRepository.DeleteAsync("PersistedGrantSubjectId1", "PersistedGrantClientId1", |
||||
|
"PersistedGrantClientId1"); |
||||
|
|
||||
|
var persistedGrants = await _persistentGrantRepository.GetListAsync(); |
||||
|
persistedGrants.ShouldNotBeEmpty(); |
||||
|
persistedGrants.ShouldNotContain(x => |
||||
|
x.Key == "PersistedGrantKey1" && x.SubjectId == "PersistedGrantSubjectId1" && |
||||
|
x.ClientId == "PersistedGrantClientId1" && x.Type == "PersistedGrantClientId1"); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue