public CourtListControllerTests()
        {
            var fileServices          = new EnvironmentBuilder("FileServicesClient:Username", "FileServicesClient:Password", "FileServicesClient:Url");
            var lookupServices        = new EnvironmentBuilder("LookupServicesClient:Username", "LookupServicesClient:Password", "LookupServicesClient:Url");
            var locationServices      = new EnvironmentBuilder("LocationServicesClient:Username", "LocationServicesClient:Password", "LocationServicesClient:Url");
            var lookupServiceClient   = new LookupCodeServicesClient(lookupServices.HttpClient);
            var locationServiceClient = new LocationServicesClient(locationServices.HttpClient);
            var fileServicesClient    = new FileServicesClient(fileServices.HttpClient);
            var lookupService         = new LookupService(lookupServices.Configuration, lookupServiceClient, new CachingService());
            var locationService       = new LocationService(locationServices.Configuration, locationServiceClient, new CachingService());

            var claims = new[] {
                new Claim(CustomClaimTypes.JcParticipantId, fileServices.Configuration.GetNonEmptyValue("Request:PartId")),
                new Claim(CustomClaimTypes.JcAgencyCode, fileServices.Configuration.GetNonEmptyValue("Request:AgencyIdentifierId")),
            };
            var identity  = new ClaimsIdentity(claims, "Cookies");
            var principal = new ClaimsPrincipal(identity);

            var courtListService = new CourtListService(fileServices.Configuration, fileServices.LogFactory.CreateLogger <CourtListService>(), fileServicesClient, new Mapper(), lookupService, locationService, new CachingService(), principal);

            _controller = new CourtListController(courtListService)
            {
                ControllerContext = HttpResponseTest.SetupMockControllerContext(fileServices.Configuration)
            };
        }
        public FilesControllerTests()
        {
            //TODO NInject or some other resolvers.
            var fileServices          = new EnvironmentBuilder("FileServicesClient:Username", "FileServicesClient:Password", "FileServicesClient:Url");
            var lookupServices        = new EnvironmentBuilder("LookupServicesClient:Username", "LookupServicesClient:Password", "LookupServicesClient:Url");
            var locationServices      = new EnvironmentBuilder("LocationServicesClient:Username", "LocationServicesClient:Password", "LocationServicesClient:Url");
            var lookupServiceClient   = new LookupCodeServicesClient(lookupServices.HttpClient);
            var locationServiceClient = new LocationServicesClient(locationServices.HttpClient);
            var fileServicesClient    = new FileServicesClient(fileServices.HttpClient);

            _fileServicesClient = fileServicesClient;
            var lookupService   = new LookupService(lookupServices.Configuration, lookupServiceClient, new CachingService());
            var locationService = new LocationService(locationServices.Configuration, locationServiceClient, new CachingService());

            _agencyIdentifierId = fileServices.Configuration.GetNonEmptyValue("Request:AgencyIdentifierId");
            _partId             = fileServices.Configuration.GetNonEmptyValue("Request:PartId");
            var claims = new[] {
                new Claim(CustomClaimTypes.JcParticipantId, _partId),
                new Claim(CustomClaimTypes.JcAgencyCode, _agencyIdentifierId),
            };
            var identity  = new ClaimsIdentity(claims, "Cookies");
            var principal = new ClaimsPrincipal(identity);

            var filesService = new FilesService(fileServices.Configuration, fileServicesClient, new Mapper(), lookupService, locationService, new CachingService(), principal);

            //TODO fake this.
            var vcCivilFileAccessHandler = new VcCivilFileAccessHandler(new ScvDbContext());

            _controller = new FilesController(fileServices.Configuration, fileServices.LogFactory.CreateLogger <FilesController>(), filesService, vcCivilFileAccessHandler);
            _controller.ControllerContext = HttpResponseTest.SetupMockControllerContext(fileServices.Configuration);
        }
 public LookupService(IConfiguration configuration, LookupCodeServicesClient lookupClient, IAppCache cache)
 {
     _configuration = configuration;
     _lookupClient  = lookupClient;
     _cache         = cache;
     _cache.DefaultCachePolicy.DefaultCacheDurationSeconds = int.Parse(configuration.GetNonEmptyValue("Caching:LookupExpiryMinutes")) * 60;
     SetupLookupServicesClient();
 }