예제 #1
0
        public async Task <List <OrganisationStandardSummary> > Handle(GetAllStandardsByOrganisationRequest request, CancellationToken cancellationToken)
        {
            _logger.LogInformation($@"Handling OrganisationStandards Request for OrganisationId [{request.OrganisationId}]");
            var orgStandards = await _registerQueryRepository.GetAllOrganisationStandardByOrganisationId(request.OrganisationId);

            return(orgStandards.ToList());
        }
예제 #2
0
        public void Setup()
        {
            effectiveFrom1         = DateTime.Today.AddYears(-1);
            effectiveFrom2         = DateTime.Today.AddMonths(-1);
            effectiveFrom3         = DateTime.Today.AddMonths(-2);
            effectiveTo2           = DateTime.Today.AddMonths(1);
            _id1                   = 1;
            _id2                   = 2;
            _id3                   = 3;
            _expectedDeliveryAreas = new List <int> {
                1, 2
            };

            RegisterQueryRepository = new Mock <IRegisterQueryRepository>();

            _standard1 = new OrganisationStandardSummary {
                Id = _id1, OrganisationId = _organisationId, DeliveryAreas = _expectedDeliveryAreas, StandardCode = _standardCode1, EffectiveFrom = effectiveFrom1
            };
            _standard2 = new OrganisationStandardSummary {
                Id = _id2, OrganisationId = _organisationId, DeliveryAreas = _expectedDeliveryAreas, StandardCode = _standardCode2, EffectiveFrom = effectiveFrom2, EffectiveTo = effectiveTo2
            };
            _standard3 = new OrganisationStandardSummary {
                Id = _id3, OrganisationId = _organisationId, DeliveryAreas = _expectedDeliveryAreas, StandardCode = _standardCode3, EffectiveFrom = effectiveFrom3
            };

            _expectedStandards = new List <OrganisationStandardSummary>
            {
                _standard1,
                _standard2,
                _standard3
            };

            _request = new GetAllStandardsByOrganisationRequest {
                OrganisationId = _organisationId
            };

            Logger = new Mock <ILogger <GetAllStandardsByOrganisationHandler> >();

            RegisterQueryRepository.Setup(r => r.GetAllOrganisationStandardByOrganisationId(_organisationId))
            .Returns(Task.FromResult(_expectedStandards.AsEnumerable()));

            GetAllStandardsByOrganisationHandler =
                new GetAllStandardsByOrganisationHandler(RegisterQueryRepository.Object, Logger.Object);
        }