Esempio n. 1
0
        public async Task GetExam_WithExamId_ReturnsExistingExam()
        {
            //Arrange
            var examId  = AutoFaker.Generate <int>();
            var exam    = AutoFaker.Generate <Exam>();
            var examDto = AutoFaker.Generate <ExamDto>();

            _examService.Setup(x => x.GetExamById(It.IsAny <int>()))
            .ReturnsAsync(exam);
            _mapper.Setup(x => x.Map <ExamDto>(exam))
            .Returns(examDto);

            //Act
            var result = await _sut.GetExam(examId);

            //Assert
            result.Should().BeOfType <OkObjectResult>();
            ((OkObjectResult)result).StatusCode.Should().Be(StatusCodes.Status200OK);
            ((OkObjectResult)result).Value.Should().BeEquivalentTo(examDto);
        }