Beispiel #1
0
        public async Task Test_add_user_modify_lockout_enabled_delete()
        {
            var dao = Global.TenantDao;
            await dao.EstablishConnectionAsync();

            var guidId    = Guid.NewGuid();
            var userStore = new CassandraUserStore();

            string userName = Guid.NewGuid().ToString();
            var    user     = new CassandraUser()
            {
                Email                = userName,
                UserName             = userName,
                EmailConfirmed       = false,
                PhoneNumberConfirmed = false,
                PhoneNumber          = "310.383.1111",
                LockoutEnabled       = false
            };
            await userStore.CreateAsync(user);

            var foundUser = await userStore.FindByEmailAsync(userName);

            Assert.IsNotNull(foundUser);
            Assert.IsFalse(await userStore.GetLockoutEnabledAsync(foundUser));

            await userStore.SetLockoutEnabledAsync(foundUser, true);

            await userStore.UpdateAsync(foundUser);

            foundUser = await userStore.FindByEmailAsync(userName);

            Assert.IsNotNull(foundUser);
            Assert.IsTrue(await userStore.GetLockoutEnabledAsync(foundUser));

            await userStore.DeleteAsync(foundUser);

            foundUser = await userStore.FindByEmailAsync(userName);

            Assert.IsNull(foundUser);
        }