Exemplo n.º 1
0
 public UserController(IAppSensor appSensor, IAppConfiguration configuration, ISeContext context,
                       IHttpCache httpCache, IUserIdentity userIdentity, IUserManager userManager, IServices services) : base(
         userIdentity, appSensor)
 {
     _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
     _context       = context ?? throw new ArgumentNullException(nameof(context));
     _httpCache     = httpCache ?? throw new ArgumentNullException(nameof(httpCache));
     _services      = services ?? throw new ArgumentNullException(nameof(services));
     _userManager   = userManager ?? throw new ArgumentNullException(nameof(userManager));
 }
 public BaseController(
     IHttpCache cache,
     IHttpSession session,
     IDataRepository dataRepository,
     IWebTracker webTracker)
 {
     DataRepository = dataRepository;
     WebTracker     = webTracker;
     Cache          = cache;
     Session        = session;
 }
Exemplo n.º 3
0
 public AccountController(IAppSensor appSensor, IAppConfiguration configuration, IEncryption encryption, IFormsAuth formsAuth, ISeContext context, IHttpCache httpCache, IUserManager userManager, IRecaptcha recaptcha, IServices services, IUserIdentity userIdentity) : base(userIdentity, appSensor)
 {
     _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
     _context       = context ?? throw new ArgumentNullException(nameof(context));
     _encryption    = encryption ?? throw new ArgumentNullException(nameof(encryption));
     _formsAuth     = formsAuth ?? throw new ArgumentNullException(nameof(formsAuth));
     _httpCache     = httpCache ?? throw new ArgumentNullException(nameof(httpCache));
     _recaptcha     = recaptcha ?? throw new ArgumentNullException(nameof(recaptcha));
     _services      = services ?? throw new ArgumentNullException(nameof(services));
     _userManager   = userManager ?? throw new ArgumentNullException(nameof(userManager));
 }
 public SubmitController(
     IHttpCache cache,
     IHttpSession session,
     ISubmissionService submitService,
     IDataRepository dataRepository,
     IWebTracker webTracker,
     EmailSendingService emailSendingService)
     : base(cache, session, dataRepository, webTracker)
 {
     submissionService        = submitService;
     this.emailSendingService = emailSendingService;
 }
 public CompareController(
     IHttpCache cache,
     IHttpSession session,
     ISearchViewService searchViewService,
     ICompareViewService compareViewService,
     IDataRepository dataRepository,
     IOrganisationBusinessLogic organisationBusinessLogic,
     IWebTracker webTracker) : base(cache, session, dataRepository, webTracker)
 {
     OrganisationBusinessLogic = organisationBusinessLogic;
     SearchViewService         = searchViewService;
     CompareViewService        = compareViewService;
 }
Exemplo n.º 6
0
        public void SetUp()
        {
            _innerRequester = Substitute.For <IHttpRequester>();
            _innerRequester.Request(NotFoundUri, Arg.Any <Options>())
            .Returns(Observable.Throw <Response>(new HttpException(new Uri(""), HttpStatusCode.NotFound)));
            _innerRequester.Request(NotModifiedUri, Arg.Any <Options>())
            .Returns(Observable.Throw <Response>(new HttpException(new Uri(""), HttpStatusCode.NotModified)));

            _httpCache = Substitute.For <IHttpCache>();
            _httpCache.LoadHeaders(Arg.Any <Uri>()).Returns((Dictionary <string, string>)null);

            _fixture = new HttpCacheRequester(_innerRequester, _httpCache);
        }
Exemplo n.º 7
0
        public BaseController(
            ILogger logger,
            IWebService webService,
            ISharedBusinessLogic sharedBusinessLogic)
        {
            Logger = logger;
            WebService = webService;
            AutoMapper = webService.AutoMapper;
            Cache = webService.Cache;
            Session = webService.Session;
            WebTracker = webService.WebTracker;

            SharedBusinessLogic = sharedBusinessLogic;
        }
 public void Setup()
 {
     BaseSetup();
     _appSensor     = MockRepository.GenerateMock <IAppSensor>();
     _configuration = MockRepository.GenerateStub <IAppConfiguration>();
     _httpCache     = MockRepository.GenerateMock <IHttpCache>();
     _services      = MockRepository.GenerateMock <IServices>();
     _userManager   = MockRepository.GenerateMock <IUserManager>();
     _sut           = new UserController(_appSensor, _configuration, Context, _httpCache, UserIdentity, _userManager, _services)
     {
         Url = new UrlHelper(new RequestContext(HttpContext, new RouteData()), new RouteCollection())
     };
     _sut.ControllerContext = new ControllerContext(HttpContext, new RouteData(), _sut);
 }
Exemplo n.º 9
0
 public void Setup()
 {
     BaseSetup();
     _appSensor     = MockRepository.GenerateMock <IAppSensor>();
     _configuration = MockRepository.GenerateMock <IAppConfiguration>();
     _encryption    = MockRepository.GenerateMock <IEncryption>();
     _formsAuth     = MockRepository.GenerateMock <IFormsAuth>();
     _httpCache     = MockRepository.GenerateMock <IHttpCache>();
     _recaptcha     = MockRepository.GenerateMock <IRecaptcha>();
     _services      = MockRepository.GenerateMock <IServices>();
     _userManager   = MockRepository.GenerateMock <IUserManager>();
     _sut           = new AccountController(_appSensor, _configuration, _encryption, _formsAuth, Context,
                                            _httpCache, _userManager, _recaptcha, _services, UserIdentity);
     _sut.ControllerContext = new ControllerContext(HttpContext, new RouteData(), _sut);
 }
Exemplo n.º 10
0
 public WebService(IErrorViewModelFactory errorViewModelFactory, FeatureSwitchOptions featureSwitchOptions,
                   IMapper autoMapper, IHttpCache cache, IHttpSession session, IWebHostEnvironment hostingEnvironment,
                   IShortCodesRepository shortCodesRepository, IWebTracker webTracker,
                   IEventLogger eventLogger)
 {
     ErrorViewModelFactory = errorViewModelFactory;
     FeatureSwitchOptions  = featureSwitchOptions;
     AutoMapper            = autoMapper;
     Cache                = cache;
     Session              = session;
     HostingEnvironment   = hostingEnvironment;
     ShortCodesRepository = shortCodesRepository;
     WebTracker           = webTracker;
     CustomLogger         = eventLogger;
 }
Exemplo n.º 11
0
 public RegisterController(
     IHttpCache cache,
     IHttpSession session,
     IDataRepository dataRepository,
     IWebTracker webTracker,
     EmailSendingService emailSendingService,
     AuditLogger auditLogger)
     : base(
         cache,
         session,
         dataRepository,
         webTracker)
 {
     this.emailSendingService = emailSendingService;
     this.auditLogger         = auditLogger;
 }
 public void Setup()
 {
     BaseSetup();
     _appSensor     = MockRepository.GenerateMock <IAppSensor>();
     _configuration = MockRepository.GenerateStub <IAppConfiguration>();
     _configuration.Stub(a => a.HasRecaptcha).Return(true);
     _encryption  = MockRepository.GenerateMock <IEncryption>();
     _formsAuth   = MockRepository.GenerateMock <IFormsAuth>();
     _httpCache   = MockRepository.GenerateMock <IHttpCache>();
     _userManager = MockRepository.GenerateMock <IUserManager>();
     _recaptcha   = MockRepository.GenerateMock <IRecaptcha>();
     _services    = MockRepository.GenerateMock <IServices>();
     _sut         = new AccountController(_appSensor, _configuration, _encryption, _formsAuth, Context, _httpCache, _userManager, _recaptcha, _services, UserIdentity);
     HttpRequest.Stub(x => x.Url).Return(new Uri("http://localhost/a", UriKind.Absolute));
     _sut.Url = MockRepository.GenerateMock <UrlHelper>();
     _sut.ControllerContext = new ControllerContext(HttpContext, new RouteData(), _sut);
 }
Exemplo n.º 13
0
 public OrganisationController(
     IHttpCache cache,
     IHttpSession session,
     ISubmissionService submitService,
     IScopeBusinessLogic scopeBL,
     IDataRepository dataRepository,
     RegistrationRepository registrationRepository,
     IWebTracker webTracker,
     EmailSendingService emailSendingService) : base(
         cache,
         session,
         dataRepository,
         webTracker)
 {
     SubmissionService        = submitService;
     ScopeBusinessLogic       = scopeBL;
     RegistrationRepository   = registrationRepository;
     this.emailSendingService = emailSendingService;
 }
 public ViewingController(
     IHttpCache cache,
     IHttpSession session,
     IViewingService viewingService,
     ISearchViewService searchViewService,
     ICompareViewService compareViewService,
     IOrganisationBusinessLogic organisationBusinessLogic,
     ISubmissionBusinessLogic submissionBusinessLogic,
     IObfuscator obfuscator,
     IDataRepository dataRepository,
     IWebTracker webTracker,
     AutoCompleteSearchService autoCompleteSearchService,
     IFileRepository fileRepository) : base(cache, session, dataRepository, webTracker)
 {
     ViewingService            = viewingService;
     SearchViewService         = searchViewService;
     CompareViewService        = compareViewService;
     OrganisationBusinessLogic = organisationBusinessLogic;
     Obfuscator = obfuscator;
     SubmissionBusinessLogic        = submissionBusinessLogic;
     this.autoCompleteSearchService = autoCompleteSearchService;
     this.fileRepository            = fileRepository;
 }
Exemplo n.º 15
0
 public CurrencyApi(Uri builder, IHttpCache cache)
 {
     _cache = cache;
     _uri   = builder;
 }
Exemplo n.º 16
0
 public SingleSessionHelper(IHttpCache <UserLoginSessionInfo> httpCache)
 {
     _httpCache = httpCache;
 }
Exemplo n.º 17
0
 public HttpCacheRequester(IHttpRequester requester, IHttpCache httpCache, HttpCachePolicy?defaultPolicy = null)
 {
     _requester     = requester;
     _httpCache     = httpCache;
     _defaultPolicy = defaultPolicy ?? HttpCachePolicy.OriginOnly;
 }
Exemplo n.º 18
0
 public HttpCacheActionFilter(IStringLocalizer <HttpCacheActionFilter> localizer, IHttpCache cache, IOptions <JsonOptions> options, IOptionsSnapshot <ProblemDetailsOptions> problemDetailOptions, ILogger <HttpCacheActionFilter> logger)
 {
     _localizer            = localizer;
     _cache                = cache;
     _options              = options;
     _problemDetailOptions = problemDetailOptions;
     _logger               = logger;
 }
Exemplo n.º 19
0
 public HttpCacheFilterAttribute(IETagGenerator generator, IHttpCache cache, JsonSerializerOptions options)
 {
     _generator = generator;
     _cache     = cache;
     _options   = options;
 }
Exemplo n.º 20
0
 public Http(IHttpCache cache = null)
 {
     this.cache = cache;
 }
Exemplo n.º 21
0
 /// <summary>
 /// Initialises a new instance of the <see cref="HttpStandardKeyStrategy"/> class.
 /// </summary>
 /// <param name="cache">The <see cref="IHttpCache"/> that will be used to store vary headers.</param>
 /// <param name="cacheKeySetting">The <see cref="CacheKeySetting"/> that will be used to determine which part of the URI that will be used to create the key.</param>
 public HttpStandardKeyStrategy(IHttpCache cache, CacheKeySetting cacheKeySetting = CacheKeySetting.Standard)
 {
     _cache           = cache ?? throw new ArgumentNullException(nameof(cache));
     _cacheKeySetting = cacheKeySetting;
 }
Exemplo n.º 22
0
 /// <summary>
 /// Initialises a new instance of the <see cref="HttpCachingHandler"/> class.
 /// </summary>
 /// <param name="cache">The <see cref="IHttpCache"/> that will be used to store HTTP responses.</param>
 /// <param name="keyStrategy">The <see cref="ICacheKeyStrategy"/> that will be used to create cache keys.</param>
 public HttpCachingHandler(IHttpCache cache, ICacheKeyStrategy keyStrategy)
 {
     _cache       = cache ?? throw new ArgumentNullException(nameof(cache));
     _keyStrategy = keyStrategy ?? throw new ArgumentNullException(nameof(keyStrategy));
     InnerHandler = new HttpClientHandler();
 }
Exemplo n.º 23
0
 public CurrencyApi(Uri builder, IHttpCache cache)
 {
     _cache = cache;
     _uri = builder;
 }
Exemplo n.º 24
0
 public CacheFilterBaseAttribute()
 {
     _cache   = DependencyResolver.Current.GetService <IHttpCache>();
     Priority = CacheItemPriority.Default;
 }
Exemplo n.º 25
0
 /// <summary>
 /// Initialises a new instance of the <see cref="HttpCachingHandler"/> class with the default message handler.
 /// </summary>
 /// <param name="cache">The <see cref="IHttpCache"/> that will be used to store HTTP responses.</param>
 /// <param name="keyStrategy">The <see cref="ICacheKeyStrategy"/> that will be used to create cache keys.</param>
 public HttpCachingHandler(IHttpCache cache, ICacheKeyStrategy keyStrategy) : this(cache, keyStrategy, new HttpClientHandler())
 {
 }
Exemplo n.º 26
0
 /// <summary>
 /// Initialises a new instance of the <see cref="HttpCachingHandler"/> class with the given <see cref="HttpMessageHandler"/>
 /// </summary>
 /// <param name="cache">The <see cref="IHttpCache"/>; that will be used to store HTTP responses.</param>
 /// <param name="keyStrategy">The <see cref="ICacheKeyStrategy"/> that will be used to create cache keys.</param>
 /// <param name="innerHandler">The <see cref="HttpMessageHandler"/> that will be used to send the HTTP request.</param>
 public HttpCachingHandler(IHttpCache cache, ICacheKeyStrategy keyStrategy, HttpMessageHandler innerHandler)
 {
     _cache       = cache ?? throw new ArgumentNullException(nameof(cache));
     _keyStrategy = keyStrategy ?? throw new ArgumentNullException(nameof(keyStrategy));
     InnerHandler = innerHandler;
 }
Exemplo n.º 27
0
 public HttpCacheFilterAttribute(IETagGenerator generator, IHttpCache cache, JsonSerializerSettings settings)
 {
     _generator = generator;
     _cache     = cache;
     _settings  = settings;
 }