コード例 #1
0
 public ServiceRecipientsSectionController(IOrderRepository orderRepository,
                                           IServiceRecipientRepository serviceRecipientRepository)
 {
     _orderRepository            = orderRepository ?? throw new ArgumentNullException(nameof(orderRepository));
     _serviceRecipientRepository = serviceRecipientRepository ??
                                   throw new ArgumentNullException(nameof(serviceRecipientRepository));
 }
        private OrganisationControllerBuilder(List <Claim> claims)
        {
            createOrganisationService  = Mock.Of <ICreateOrganisationService>();
            organisationRepository     = Mock.Of <IOrganisationRepository>();
            serviceRecipientRepository = Mock.Of <IServiceRecipientRepository>();

            claimsPrincipal = new ClaimsPrincipal(new ClaimsIdentity(claims, "mock"));
        }
 public OrganisationsController(
     IOrganisationRepository organisationRepository,
     ICreateOrganisationService createOrganisationService,
     IServiceRecipientRepository serviceRecipientRepository)
 {
     _organisationRepository     = organisationRepository ?? throw new ArgumentNullException(nameof(organisationRepository));
     _createOrganisationService  = createOrganisationService ?? throw new ArgumentNullException(nameof(createOrganisationService));
     _serviceRecipientRepository = serviceRecipientRepository ?? throw new ArgumentNullException(nameof(serviceRecipientRepository));
 }
        private OrganisationControllerBuilder(Guid primaryOrganisationId)
        {
            createOrganisationService  = Mock.Of <ICreateOrganisationService>();
            organisationRepository     = Mock.Of <IOrganisationRepository>();
            serviceRecipientRepository = Mock.Of <IServiceRecipientRepository>();

            var claims = new[] { new Claim("primaryOrganisationId", primaryOrganisationId.ToString()) };

            claimsPrincipal = new ClaimsPrincipal(new ClaimsIdentity(claims, "mock"));
        }
        internal OrganisationControllerBuilder WithServiceRecipients(IEnumerable <ServiceRecipient> result)
        {
            var mockServiceRecipientsRepository = new Mock <IServiceRecipientRepository>();

            mockServiceRecipientsRepository.Setup(x => x.GetServiceRecipientsByParentOdsCode(It.IsAny <string>()))
            .ReturnsAsync(result);

            _serviceRecipientRepository = mockServiceRecipientsRepository.Object;
            return(this);
        }
 internal OrdersControllerBuilder WithServiceRecipientRepository(IServiceRecipientRepository serviceRecipientRepository)
 {
     _serviceRecipientRepository = serviceRecipientRepository;
     return(this);
 }