예제 #1
0
    public async Task CanCreateUsingAddRoleManager()
    {
        var manager = TestIdentityFactory.CreateRoleManager(_fixture.Connection);

        Assert.NotNull(manager);
        IdentityResultAssert.IsSuccess(await manager.CreateAsync(new IdentityRole("arole")));
    }
예제 #2
0
    public async Task CanUpdateRoleName()
    {
        var manager = TestIdentityFactory.CreateRoleManager(_fixture.Connection);
        var role    = new IdentityRole("UpdateRoleName");

        IdentityResultAssert.IsSuccess(await manager.CreateAsync(role));
        Assert.Null(await manager.FindByNameAsync("New"));
        IdentityResultAssert.IsSuccess(await manager.SetRoleNameAsync(role, "New"));
        IdentityResultAssert.IsSuccess(await manager.UpdateAsync(role));
        Assert.NotNull(await manager.FindByNameAsync("New"));
        Assert.Null(await manager.FindByNameAsync("UpdateAsync"));
    }