Beispiel #1
0
        public async Task Remove2FA_InvalidUser_Success()
        {
            string USER_ID = Guid.NewGuid().ToString();

            var service = new AdminUserService(dbContext, userManager, roleManager, signInManager, new Mock <IServerNewsService>().Object);

            await service.Remove2FaAsync(USER_ID);

            Assert.IsNull(await dbContext.Users.FindAsync(USER_ID));
        }
Beispiel #2
0
        public async Task Remove2FA_ValidUserWithout2FA_Success()
        {
            string USER_ID = Guid.NewGuid().ToString();

            await dbContext.Users.AddAsync(new User("TestName", "TestUserName", "*****@*****.**", DateTime.Now) { Id = USER_ID, TwoFactorEnabled = false });

            await dbContext.SaveChangesAsync();

            var service = new AdminUserService(dbContext, userManager, roleManager, signInManager, new Mock <IServerNewsService>().Object);

            await service.Remove2FaAsync(USER_ID);

            Assert.IsFalse((await dbContext.Users.FindAsync(USER_ID)).TwoFactorEnabled);
        }