public void Setup() { client = new CustomWebApplicationFactory <Startup>().CreateClient(); exam = ExamTestUtils.GetExam(); examDto = ExamTestUtils.GetExamDto(exam.Id); examCreatingDto = ExamTestUtils.GetExamCreatingDto(); }
public void Cleanup() { this._exam = null; this._examDto = null; this._examCreatingDto = null; this._examMapper = null; }
public void Setup() { this._exam = ExamTestUtils.GetExam(); this._examDto = ExamTestUtils.GetExamDto(this._exam.Id); this._examCreatingDto = ExamTestUtils.GetExamCreatingDto(); this._examMapper = new ExamMapper(); }
public BaremAddedEmail(string to, Domain.Entities.Exam exam) { this.Message = "To: " + to + "\r\n" + "Subject: Barem added for " + exam.Course.Name + "\r\n" + "Content-Type: text/plain; charset=us-ascii\r\n\r\n" + "The barem for " + exam.Course.Name + " exam was added."; }
public static Domain.Entities.Exam GetExam() { if (exam == null) { exam = new Domain.Entities.Exam(MyDateTime, CourseTestUtils.GetCourse()); } return(exam); }
public async Task GetExamById_ShouldReturnExamWithThatId() { // Arrange _mockReadRepository.Setup(repo => repo.GetByIdAsync <Domain.Entities.Exam>(_exam.Id)).ReturnsAsync(_exam); // Act Domain.Entities.Exam actualExam = await this._examService.GetById(_exam.Id); // Assert actualExam.Should().BeEquivalentTo(_exam); }
public ExamCreatedEmail(string to, Domain.Entities.Exam exam) { this.Message = "To: " + to + "\r\n" + "Subject: Exam Created for " + exam.Course.Name + "\r\n" + "Content-Type: text/plain; charset=us-ascii\r\n\r\n" + "The exam for " + exam.Course.Name + " will take place on " + exam.Date.ToString("dd MMMM yyyy") + " at " + exam.Date.ToString("hh:mm tt") + "\nClassrooms allocated for the exam: " + this.GetClassrooms(exam); }
private string GetClassrooms(Domain.Entities.Exam exam) { string result = ""; foreach (var classroomAllocation in exam.ClassroomAllocation) { result += classroomAllocation.Classroom.Location.ToUpper() + ", "; } result = result.Remove(result.Length - 2) + '.'; return(result); }
public async Task <ExamDto> Create(ExamCreatingDto examCreatingDto) { var course = await courseService.GetCourseById(examCreatingDto.CourseId); Domain.Entities.Exam exam = examMapper.Map(examCreatingDto, course); await writeRepository.AddNewAsync(exam); await writeRepository.SaveAsync(); var classroomAllocations = classroomAllocationMapper.Map(examCreatingDto, exam.Id); foreach (var ca in classroomAllocations) { await classroomAllocationService.Create(ca); } await this.SendExamCreatedEmail(exam.Id); return(examMapper.Map(exam)); }
public void TestInitialize() { this._exam = ExamTestUtils.GetExam(); this._examDto = ExamTestUtils.GetExamDto(_exam.Id); this._examCreatingDto = ExamTestUtils.GetExamCreatingDto(); this._mockReadRepository = new Mock <IReadRepository>(); this._mockWriteRepository = new Mock <IWriteRepository>(); this._mockCourseService = new Mock <ICourseService>(); this._mockExamMapper = new Mock <IExamMapper>(); this._mockStudentCourseService = new Mock <IStudentCourseService>(); this._mockStudentService = new Mock <IStudentService>(); this._mockClassroomAllocationService = new Mock <IClassroomAllocationService>(); this._mockClassroomAllocationMapper = new Mock <IClassroomAllocationMapper>(); this._mockStudentMapper = new Mock <IStudentMapper>(); this._mockGradeMapper = new Mock <IGradeMapper>(); this._mockEmailService = new Mock <IEmailService>(); _examService = new ExamService(_mockReadRepository.Object, _mockWriteRepository.Object, _mockExamMapper.Object, _mockCourseService.Object, _mockStudentCourseService.Object, _mockStudentService.Object, _mockClassroomAllocationService.Object, _mockClassroomAllocationMapper.Object, _mockGradeMapper.Object, _mockStudentMapper.Object, _mockEmailService.Object); }
public Domain.Entities.Grade Map(GradeCreationDto gradeCreationDto, Domain.Entities.Student student, Domain.Entities.Exam exam) { return(new Domain.Entities.Grade(student, exam)); }
public Domain.Entities.ClassroomAllocation Map(Domain.Entities.Exam exam, Domain.Entities.Classroom classroom) { return(new Domain.Entities.ClassroomAllocation(exam, classroom)); }
public ExamDto Map(Domain.Entities.Exam exam) { return(new ExamDto(exam.Id, exam.Course.Id, exam.Date)); }