Пример #1
0
        public async Task Given_GetExams_When_ModelIsValid_Then_OkStatusCode()
        {
            // Arrange
            mockRepo
            .Setup(e => e.GetAll())
            .ReturnsAsync(new List <ExamDetailsModel>());

            //Act
            var result = await controller.GetExams();

            //Arrange
            Assert.IsType <OkObjectResult>(result);
        }
Пример #2
0
        public async Task GetExams_WithUserId_ReturnsExamList()
        {
            //Arrange
            var userId = AutoFaker.Generate <int>();
            var exams  = AutoFaker.Generate <List <Exam> >();

            _examService.Setup(x => x.GetExams(It.IsAny <int>()))
            .ReturnsAsync(exams);

            //Act
            var result = await _sut.GetExams(userId);

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