public void Arrange()
        {
            _request = new GetPeriodQueryRequest
            {
                PeriodId = "1617-R02"
            };

            _requestValidator = new Mock <IValidator <GetPeriodQueryRequest> >();
            _requestValidator.Setup(v => v.Validate(It.IsAny <GetPeriodQueryRequest>()))
            .Returns(Task.FromResult(new ValidationResult()));

            _periodRepository = new Mock <IPeriodRepository>();
            _periodRepository.Setup(r => r.GetPeriod("1617-R02"))
            .Returns(Task.FromResult(new PeriodEntity
            {
                Period       = 2,
                AcademicYear = 1617,
                ReferenceDataValidationDate = _expectedDate,
                CompletionDate = _expectedDate
            }));

            _mapper = new AutoMapperMapper(AutoMapperConfigurationFactory.CreateMappingConfig());

            _handler = new Application.Period.GetPeriodQuery.GetPeriodQueryHandler(_requestValidator.Object, _periodRepository.Object, _mapper);
        }
コード例 #2
0
        public void Arrange()
        {
            _request = new GetPeriodQueryRequest
            {
                PeriodId = "1617-R02"
            };

            _requestValidator = new Mock <IValidator <GetPeriodQueryRequest> >();
            _requestValidator.Setup(v => v.Validate(It.IsAny <GetPeriodQueryRequest>()))
            .Returns(Task.FromResult(new ValidationResult()));

            _periodRepository = new Mock <IPeriodRepository>();
            _periodRepository.Setup(r => r.GetPeriod("1617", "R02"))
            .Returns(Task.FromResult(new PeriodEntity
            {
                Id            = "1617-R02",
                CalendarMonth = 9,
                CalendarYear  = 2016
            }));

            _handler = new Application.Period.GetPeriodQuery.GetPeriodQueryHandler(_requestValidator.Object, _periodRepository.Object);
        }