예제 #1
0
 public void Copy(IGenericEmail target)
 {
     if (target != null)
     {
         target.Email = Email;
     }
 }
        public async Task Create_ShouldReturnInstanceOfCourseDetailsDto()
        {
            // Arrange
            _mockCourseService.Setup(service => service.GetCourseById(_examCreatingDto.CourseId)).ReturnsAsync(CourseTestUtils.GetCourse());
            _mockExamMapper.Setup(mapper => mapper.Map(_examCreatingDto, CourseTestUtils.GetCourse())).Returns(_exam);
            _mockWriteRepository.Setup(repo => repo.AddNewAsync <Domain.Entities.Exam>(_exam)).Returns(() => Task.FromResult(_exam));
            _mockExamMapper.Setup(mapper => mapper.Map(_exam)).Returns(_examDto);
            var expectedStudents = new List <Student> {
                StudentTestUtils.GetStudent()
            };
            var expectedExams = new List <Domain.Entities.Exam> {
                _exam
            };

            _mockReadRepository.Setup(repo => repo.GetAll <Student>()).Returns(expectedStudents.AsQueryable().BuildMock());
            _mockReadRepository.Setup(repo => repo.GetAll <Domain.Entities.Exam>()).Returns(expectedExams.AsQueryable().BuildMock());
            IGenericEmail email = null;

            _mockEmailService.Setup(service => service.SendEmail(email)).Verifiable();

            var classroomAllocation = new List <ClassroomAllocationCreatingDto> {
            };

            _mockClassroomAllocationMapper.Setup(mapper => mapper.Map(_examCreatingDto, _exam.Id)).Returns(classroomAllocation);

            // Act
            ExamDto actualExam = await this._examService.Create(_examCreatingDto);

            // Assert
            actualExam.Should().BeEquivalentTo(_examDto);
        }
예제 #3
0
        public void SendEmail(IGenericEmail email)
        {
            var message = new Google.Apis.Gmail.v1.Data.Message();

            message.Raw = ConvertBase64UrlEncode(email.GetEmail());
            gmailService.Users.Messages.Send(message, "me").Execute();
        }
예제 #4
0
        public async Task Create_ShouldReturnInstanceOfGradeDto()
        {
            // Arrange
            var expectedGrades = new List <Grade> {
                initialStateGrade
            };

            _mockExamService.Setup(service => service.GetById(gradeCreationDto.ExamId)).ReturnsAsync(initialStateGrade.Exam);
            _mockStudentService.Setup(service => service.GetStudentById(gradeCreationDto.StudentId))
            .ReturnsAsync(initialStateGrade.Student);
            _mockGradeMapper.Setup(mapper => mapper.Map(gradeCreationDto, initialStateGrade.Student, initialStateGrade.Exam)).Returns(initialStateGrade);
            _mockWriteRepository.Setup(repo => repo.AddNewAsync <Domain.Entities.Grade>(initialStateGrade))
            .Returns(() => Task.FromResult(initialStateGrade));
            _mockGradeMapper.Setup(mapper => mapper.Map(initialStateGrade)).Returns(initialStateGradeDto);
            _mockReadRepository.Setup(repo => repo.GetAll <Grade>()).Returns(expectedGrades.AsQueryable().BuildMock());
            IGenericEmail email = null;

            _mockEmailService.Setup(service => service.SendEmail(email)).Verifiable();
            // Act
            GradeDto actualGrade = await this._gradeService.Create(gradeCreationDto);

            // Assert
            actualGrade.Should().BeEquivalentTo(initialStateGradeDto);
        }