public async Task GetCreatedExamsForUserAsync_ValidRequest_ReturnsOkObjectResult() { var user = new ClaimsPrincipal(new ClaimsIdentity(new Claim[] { new Claim(ClaimTypes.NameIdentifier, "1"), })); var mapperMock = new Mock <IMapper>(); var repositoryMock = new Mock <IRepositoryWrapper>(); repositoryMock.Setup(r => r.ExamRepository.GetCreatedExamsForUserAsync(It.IsAny <int>())).ReturnsAsync(new List <Exam>()); mapperMock.Setup(m => m.Map <IEnumerable <ExamForListDto> >(It.IsAny <IEnumerable <Exam> >())).Returns(new List <ExamForListDto>()); var controllerMock = new ExamsController(repositoryMock.Object, mapperMock.Object); controllerMock.ControllerContext = new ControllerContext() { HttpContext = new DefaultHttpContext() { User = user } }; var result = await controllerMock.GetCreatedExamsForUserAsync(); Assert.IsType <OkObjectResult>(result); }