public void Cannot_Delete_One_User() { IdentityUser[] users = new IdentityUser[] { new IdentityUser("User1") { Id = "9E922BD2-4395-4524-8264-4F218D600E9D" }, new IdentityUser("User2") { Id = "4192883F-AA46-42EA-B1DD-73E8CAA7A7B3" } }; UserManagerMock.Setup(m => m.Users).Returns(users.AsQueryable()); UserManagerMock.Setup(m => m.DeleteAsync(It.IsAny <IdentityUser>())) .ReturnsAsync(IdentityResult.Failed()); var target = new UserController(UserManagerMock.Object, null, null, null, null, null); var resultAction = (target.Delete(Guid.Parse(users[0].Id))).Result as RedirectToActionResult; Assert.Null(resultAction); }