public async Task DynamoRoleStore_Delete_DeletesRole() { var roleName = TestUtils.RandomString(10); var role = new DynamoIdentityRole(roleName); using (var dbProvider = DynamoDbServerTestUtils.CreateDatabase()) { var roleStore = new DynamoRoleStore <DynamoIdentityRole>(); await roleStore.EnsureInitializedAsync(dbProvider.Client, dbProvider.Context); await roleStore.CreateAsync(role, CancellationToken.None); await Task.Delay(2000); role = await roleStore.FindByIdAsync(role.Id, CancellationToken.None); // ACT await roleStore.DeleteAsync(role, CancellationToken.None); // ASSERT var result = await roleStore.FindByIdAsync(role.Id, CancellationToken.None); Assert.Null(result); } }
public async Task RemoveRole(string roleName, CancellationToken cancellationToken = default(CancellationToken)) { var role = await roleStore.FindByNameAsync(keyNormalizer.Normalize(roleName), cancellationToken); if (role == null) { throw new Exception($"role named {roleName} not found"); } await roleStore.DeleteAsync(role, cancellationToken); }