public async Task GetResultTest()
        {
            unitOfWorksMock
            .Setup(u => u.TestResults.GetAsync(It.IsAny <int>()))
            .ReturnsAsync((int id) => new TestResult
            {
                Id          = id,
                AttemptDate = DateTime.Today,
                Result      = 100,
                TestId      = 0,
                UserId      = "user_id"
            });

            var result = await testResultService.GetResult("user_id", 0);

            Assert.IsTrue(result.Success);
        }
Пример #2
0
        public async Task <IActionResult> GetResult(int id)
        {
            string userId = HttpContext.User.FindFirst(ClaimTypes.Name)?.Value;

            var result = await testResultService.GetResult(userId, id);

            return(responseComposer.ComposeForGetResult(result));
        }