public async Task UsersControllerTests_GetAll() { var users = UserDummyGenerator.GenerateCollection(5) as List <User>; var userRepository = UserRepositoryMock.GetMockAndSetUpAsync(users); var unitOfWork = UnitOfWorkMock.GetMock(); var userController = new UsersController(unitOfWork.Object, userRepository.Object); var result = await userController.GetAll(); Assert.NotNull(result); Assert.IsType <OkObjectResult>(result); var resultUsers = (result as OkObjectResult).Value as List <User>; Assert.True(Enumerable.SequenceEqual(users.OrderBy(t => t.UserId), resultUsers.OrderBy(t => t.UserId), new UserComparer())); }