public async Task GetAllExamsFromCourseForStudent_ShouldReturnExamsForStudentWithThatId() { // Arrange var expectedExamsDtoList = new List <ExamDto> { _examDto }; var course = _exam.Course; var courseDtoList = new List <CourseDto> { CourseTestUtils.GetCourseDetailsDto(CourseTestUtils.GetCourse().Id) }; var student = StudentTestUtils.GetStudent(); _mockCourseService.Setup(service => service.GetCourseById(course.Id)).ReturnsAsync(course); _mockStudentCourseService.Setup(service => service.GetCourses(student.Id)).ReturnsAsync(courseDtoList); _mockStudentService.Setup(service => service.GetStudentById(student.Id)).ReturnsAsync(student); var examsList = new List <Domain.Entities.Exam> { ExamTestUtils.GetExam() }; var mockExamsQueryable = examsList.AsQueryable().BuildMock(); _mockReadRepository.Setup(repo => repo.GetAll <Domain.Entities.Exam>()).Returns(mockExamsQueryable); _mockExamMapper.Setup(mapper => mapper.Map(_exam)).Returns(_examDto); // Act var actualExamsDtoList = await _examService.GetAllExamsFromCourseForStudent(course.Id, student.Id); // Assert actualExamsDtoList.Should().BeEquivalentTo(expectedExamsDtoList); }
public void Setup() { this._course = CourseTestUtils.GetCourse(); this._courseDetailsDto = CourseTestUtils.GetCourseDetailsDto(this._course.Id); this._courseCreatingDto = CourseTestUtils.GetCourseCreatingDto(); this._courseMapper = new CourseMapper(); }
public void Setup() { client = new CustomWebApplicationFactory <Startup>().CreateClient(); course1 = CourseTestUtils.GetCourse(); course2 = CourseTestUtils.GetCourse2(); courseDetailsDto1 = CourseTestUtils.GetCourseDetailsDto(course1.Id); courseDetailsDto2 = CourseTestUtils.GetCourseDetailsDto(course2.Id); courseCreationDto = CourseTestUtils.GetCourseCreatingDto(); }
public void Setup() { this._student = StudentTestUtils.GetStudent(); this._course = CourseTestUtils.GetCourse2(); this._courseDto = CourseTestUtils.GetCourseDetailsDto(_course.Id); this._studentCourse1 = StudentCourseTestUtils.GetStudentCourse(_student.Id, _course.Id); this._studentCourse2 = StudentCourseTestUtils.GetStudentCourse2(); this._studentCourseCreationDto = StudentCourseTestUtils.GetStudentCourseCreationDto(this._studentCourse1.CourseId); this._mockReadRepository = new Mock <IReadRepository>(); this._mockWriteRepository = new Mock <IWriteRepository>(); this._mockStudentCourseMapper = new Mock <IStudentCourseMapper>(); this._mockCourseMapper = new Mock <ICourseMapper>(); this._studentCourseService = new StudentCourseService(_mockReadRepository.Object, _mockWriteRepository.Object, _mockStudentCourseMapper.Object, _mockCourseMapper.Object); }
public void TestInitialize() { this._course1 = CourseTestUtils.GetCourse(); this._course2 = CourseTestUtils.GetCourse(); this._courseDto1 = CourseTestUtils.GetCourseDetailsDto(_course1.Id); this._courseDto2 = CourseTestUtils.GetCourseDetailsDto(_course2.Id); this._courseCreatingDto = CourseTestUtils.GetCourseCreatingDto(); this._mockReadRepository = new Mock <IReadRepository>(); this._mockWriteRepository = new Mock <IWriteRepository>(); this._mockCourseMapper = new Mock <ICourseMapper>(); _mockProfessorService = new Mock <IProfessorService>(); _mockStudentService = new Mock <IStudentService>(); _courseService = new CourseService(_mockReadRepository.Object, _mockWriteRepository.Object, _mockCourseMapper.Object, _mockProfessorService.Object, _mockStudentService.Object); }