protected override void Context()
        {
            AccountService = MockRepository.GenerateStub<IAccountService>();

            Identity = new FakeIdentity(Username);
            _user = new FakePrincipal(Identity, null);

            HttpRequest = MockRepository.GenerateStub<HttpRequestBase>();
            HttpContext = MockRepository.GenerateStub<HttpContextBase>();
            HttpContext.Stub(x => x.Request).Return(HttpRequest);
            HttpContext.User = _user;

            _httpResponse = MockRepository.GenerateStub<HttpResponseBase>();
            _httpResponse.Stub(x => x.Cookies).Return(new HttpCookieCollection());
            HttpContext.Stub(x => x.Response).Return(_httpResponse);

            Logger = MockRepository.GenerateStub<ILogger>();
            WebAuthenticationService = MockRepository.GenerateStub<IWebAuthenticationService>();

            MappingEngine = MockRepository.GenerateStub<IMappingEngine>();
            AccountCreator = MockRepository.GenerateStub<IAccountCreator>();

            AccountController = new AccountController(AccountService, Logger, WebAuthenticationService, MappingEngine, null, AccountCreator);
            AccountController.ControllerContext = new ControllerContext(HttpContext, new RouteData(), AccountController);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="RetryHandler" /> class.
 /// </summary>
 /// <param name="innerHandler">The inner handler. (Usually new HttpClientHandler())</param>
 /// <param name="maxRetries">The maximum retries.</param>
 /// <param name="retryDelayMilliseconds">The retry delay milliseconds.</param>
 /// <param name="logger">The optional logger to log error messages to.</param>
 /// <remarks>
 /// When only the auth0 token provider is injected, the auth0 token provider should try to extract the client id from the 401 response header.
 /// </remarks>
 public RetryHandler(HttpMessageHandler innerHandler, uint maxRetries = 1, uint retryDelayMilliseconds = 500, ILogger logger = null)
     : base(innerHandler)
 {
     this.maxRetries = maxRetries;
     this.retryDelayMilliseconds = retryDelayMilliseconds;
     this.logger = logger;
 }
 public DefaultMessageManager(
     IMessageEventHandler messageEventHandler,
     IEnumerable<IMessagingChannel> channels) {
     _messageEventHandler = messageEventHandler;
     _channels = channels;
     Logger = NullLogger.Instance;
 }
 public DoubanOAuthService(IEncryptionService oauthHelper, IQuickLogOnService quickLogOnService)
 {
     _quickLogOnService = quickLogOnService;
     _oauthHelper = oauthHelper;
     T = NullLocalizer.Instance;
     Logger = NullLogger.Instance;
 }
 //-----------------------------------------------------------------------------------------------------------------------------------------------------
 public WebApplicationComponent(IWebAppEndpoint endpoint, Auto<ILogger> logger, IComponentContext componentContext)
 {
     _app = endpoint.Contract;
     _address = endpoint.Address;
     _logger = logger.Instance;
     _container = (ILifetimeScope)componentContext;
 }
        /// <summary>
        /// Creates a deployer instance based on settings in <see cref="DeploymentParameters"/>.
        /// </summary>
        /// <param name="deploymentParameters"></param>
        /// <param name="logger"></param>
        /// <returns></returns>
        public static IApplicationDeployer Create(DeploymentParameters deploymentParameters, ILogger logger)
        {
            if (deploymentParameters == null)
            {
                throw new ArgumentNullException(nameof(deploymentParameters));
            }

            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            if (deploymentParameters.RuntimeFlavor == RuntimeFlavor.Mono)
            {
                return new MonoDeployer(deploymentParameters, logger);
            }

            switch (deploymentParameters.ServerType)
            {
                case ServerType.IISExpress:
                    return new IISExpressDeployer(deploymentParameters, logger);
#if NET451
                case ServerType.IIS:
                    return new IISDeployer(deploymentParameters, logger);
#endif
                case ServerType.WebListener:
                case ServerType.Kestrel:
                    return new SelfHostDeployer(deploymentParameters, logger);
                default:
                    throw new NotSupportedException(
                        string.Format("Found no deployers suitable for server type '{0}' with the current runtime.", 
                        deploymentParameters.ServerType)
                        );
            }
        }
        public MessageListViewModel(
            MessageRepository messageRepository,
            [NotNull] MessageWatcher messageWatcher,
            MimeMessageLoader mimeMessageLoader,
            IPublishEvent publishEvent,
            ILogger logger)
        {
            if (messageRepository == null)
                throw new ArgumentNullException(nameof(messageRepository));
            if (messageWatcher == null)
                throw new ArgumentNullException(nameof(messageWatcher));
            if (mimeMessageLoader == null)
                throw new ArgumentNullException(nameof(mimeMessageLoader));
            if (publishEvent == null)
                throw new ArgumentNullException(nameof(publishEvent));

            _messageRepository = messageRepository;
            _messageWatcher = messageWatcher;
            _mimeMessageLoader = mimeMessageLoader;
            _publishEvent = publishEvent;
            _logger = logger;

            SetupMessages();
            RefreshMessageList();
        }
Exemple #8
0
        public InstallWalker(IPackageRepository localRepository,
                             IPackageRepository sourceRepository,
                             IPackageConstraintProvider constraintProvider,
                             FrameworkName targetFramework,
                             ILogger logger,
                             bool ignoreDependencies,
                             bool allowPrereleaseVersions)
            : base(targetFramework)
        {

            if (sourceRepository == null)
            {
                throw new ArgumentNullException("sourceRepository");
            }
            if (localRepository == null)
            {
                throw new ArgumentNullException("localRepository");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }

            Repository = localRepository;
            Logger = logger;
            SourceRepository = sourceRepository;
            _ignoreDependencies = ignoreDependencies;
            ConstraintProvider = constraintProvider;
            _operations = new OperationLookup();
            _allowPrereleaseVersions = allowPrereleaseVersions;
        }
 public PaymentPayPalStandardController(IWorkContext workContext,
     IStoreService storeService, 
     ISettingService settingService, 
     IPaymentService paymentService, 
     IOrderService orderService, 
     IOrderProcessingService orderProcessingService,
     ILocalizationService localizationService,
     IStoreContext storeContext,
     ILogger logger, 
     IWebHelper webHelper,
     PaymentSettings paymentSettings,
     PayPalStandardPaymentSettings payPalStandardPaymentSettings)
 {
     this._workContext = workContext;
     this._storeService = storeService;
     this._settingService = settingService;
     this._paymentService = paymentService;
     this._orderService = orderService;
     this._orderProcessingService = orderProcessingService;
     this._localizationService = localizationService;
     this._storeContext = storeContext;
     this._logger = logger;
     this._webHelper = webHelper;
     this._paymentSettings = paymentSettings;
     this._payPalStandardPaymentSettings = payPalStandardPaymentSettings;
 }
 public SerializationProcessor(string signKeyFile, List<string> references, List<AssemblyDefinition> memoryReferences, ILogger log)
 {
     SignKeyFile = signKeyFile;
     References = references;
     MemoryReferences = memoryReferences;
     Log = log;
 }
        public ApplicationController(ITokenHandler tokenStore) {
            TokenStore = tokenStore;
            Logger = new NLogger();
            //initialize this
            ViewBag.CurrentUser = CurrentUser ?? new { Email = "" };

        }
Exemple #12
0
        /// <summary>
        /// Logs the response.
        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="statusCode">The status code.</param>
        /// <param name="url">The URL.</param>
        /// <param name="endPoint">The end point.</param>
        /// <param name="duration">The duration.</param>
        public static void LogResponse(ILogger logger, int statusCode, string url, string endPoint, TimeSpan duration)
        {
            var durationMs = duration.TotalMilliseconds;
            var logSuffix = durationMs >= 1000 ? "ms (slow)" : "ms";

            logger.Info("HTTP Response {0} to {1}. Time: {2}{3}. {4}", statusCode, endPoint, Convert.ToInt32(durationMs).ToString(CultureInfo.InvariantCulture), logSuffix, url);
        }
        public SessionHandler(ILogger<SessionHandler> logger,
            IEnvironment environment,
            IFileSystem fileSystem,
            IKeyValueStore keyValueStore,
            IMessageBus messageBus,
            ISession session,
            ITorrentInfoRepository torrentInfoRepository,
            ITorrentMetadataRepository metadataRepository)
        {
            if (logger == null) throw new ArgumentNullException("logger");
            if (environment == null) throw new ArgumentNullException("environment");
            if (fileSystem == null) throw new ArgumentNullException("fileSystem");
            if (keyValueStore == null) throw new ArgumentNullException("keyValueStore");
            if (messageBus == null) throw new ArgumentNullException("messageBus");
            if (session == null) throw new ArgumentNullException("session");
            if (torrentInfoRepository == null) throw new ArgumentNullException("torrentInfoRepository");
            if (metadataRepository == null) throw new ArgumentNullException("metadataRepository");

            _logger = logger;
            _environment = environment;
            _fileSystem = fileSystem;
            _keyValueStore = keyValueStore;
            _messageBus = messageBus;
            _session = session;
            _torrentInfoRepository = torrentInfoRepository;
            _metadataRepository = metadataRepository;
            _muted = new List<string>();
            _alertsThread = new Thread(ReadAlerts);
        }
Exemple #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ImageSaver" /> class.
 /// </summary>
 /// <param name="config">The config.</param>
 /// <param name="libraryMonitor">The directory watchers.</param>
 /// <param name="fileSystem">The file system.</param>
 /// <param name="logger">The logger.</param>
 public ImageSaver(IServerConfigurationManager config, ILibraryMonitor libraryMonitor, IFileSystem fileSystem, ILogger logger)
 {
     _config = config;
     _libraryMonitor = libraryMonitor;
     _fileSystem = fileSystem;
     _logger = logger;
 }
        public ApplyMaximumsTask(IRepository<AUMaxBidJobControlRecord> maxbidjobcontrolRepo,
                                        IRepository<AUMaxBidRecord> maxbidRepo,
                                        IRepository<AULotLastBidChangeRecord> lotlastbidchangeRepo,

                                        ILogger logger, 
                                        IConsignorService consignorService, 
                                        ICustomerService customerService, 
                                        IQueuedEmailService queuedEmailService,
                                        IEmailAccountService emailAccountService,
                                        EmailAccountSettings emailAccountSettings,
                                        IAUCatalogService AUcatalogService,
                                        ILotService lotService)
        {
            //this._customerService = customerService;
            this._logger = logger;
            this._maxbidjobcontrolRepo = maxbidjobcontrolRepo;
            this._maxbidRepo = maxbidRepo;
            this._lotlastbidchangeRepo = lotlastbidchangeRepo;
            this._consignorService = consignorService;
            this._customerService = customerService;
            this._queuedEmailService = queuedEmailService;
            this._emailAccountService = emailAccountService;
            this._emailAccountSettings = emailAccountSettings;
            this._AUcatalogService = AUcatalogService;
            this._lotService = lotService;
        }
 public TelegramWorker(string botTokenKey)
 {
     _botTokenKey = botTokenKey;
     _telegramApi = new Api(_botTokenKey);
     _logger = FullLogger.Init();
     _dialogManager = DialogManager.Init();
 }
Exemple #17
0
        public RootContext(ITheaterApplicationHost appHost, INavigator navigator, ISessionManager sessionManager, ILogManager logManager) : base(appHost)
        {
            _appHost = appHost;
            _navigator = navigator;
            _sessionManager = sessionManager;
            _logger = logManager.GetLogger("RootContext");

            // create root navigation bindings
            Binder.Bind<LoginPath, LoginContext>();
            Binder.Bind<HomePath, HomeContext>();
            Binder.Bind<SideMenuPath, SideMenuContext>();
            Binder.Bind<FullScreenPlaybackPath, FullScreenPlaybackContext>();

            Binder.Bind<ItemListPath>(async path => {
                var context = appHost.CreateInstance(typeof (ItemListContext)) as ItemListContext;
                context.Parameters = path.Parameter;

                return context;
            });

            Binder.Bind<ItemPath>(async path => {
                var context = appHost.CreateInstance(typeof (ItemDetailsContext)) as ItemDetailsContext;
                context.Item = path.Parameter;

                return context;
            });
        }
 public SqsQueueDynamoDbCircuitBreaker(IAmazonSQS queueClient, string queueName, int breakerTripQueueSize, ILogger structuredLogger)
 {
     this.structuredLogger = structuredLogger;
     this.breakerTripQueueSize = breakerTripQueueSize;
     this.queueClient = queueClient;
     this.queueName = queueName;
 }
Exemple #19
0
        public ConnectInfoForm()
        {
            XmlConfigurator.Configure();

            var settings = new NinjectSettings()
            {
                LoadExtensions = false
            };

            this.mKernel = new StandardKernel(
                settings,
                new Log4NetModule(),
                new ReportServerRepositoryModule());

            //this.mKernel.Load<FuncModule>();

            this.mLoggerFactory = this.mKernel.Get<ILoggerFactory>();
            this.mFileSystem = this.mKernel.Get<IFileSystem>();
            this.mLogger = this.mLoggerFactory.GetCurrentClassLogger();

            InitializeComponent();

            this.LoadSettings();

            // Create the DebugForm and hide it if debug is False
            this.mDebugForm = new DebugForm();
            this.mDebugForm.Show();
            if (!this.mDebug)
                this.mDebugForm.Hide();
        }
Exemple #20
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RazorViewEngine" />.
        /// </summary>
        public RazorViewEngine(
            IRazorPageFactoryProvider pageFactory,
            IRazorPageActivator pageActivator,
            HtmlEncoder htmlEncoder,
            IOptions<RazorViewEngineOptions> optionsAccessor,
            ILoggerFactory loggerFactory)
        {
            _options = optionsAccessor.Value;

            if (_options.ViewLocationFormats.Count == 0)
            {
                throw new ArgumentException(
                    Resources.FormatViewLocationFormatsIsRequired(nameof(RazorViewEngineOptions.ViewLocationFormats)),
                    nameof(optionsAccessor));
            }

            if (_options.AreaViewLocationFormats.Count == 0)
            {
                throw new ArgumentException(
                    Resources.FormatViewLocationFormatsIsRequired(nameof(RazorViewEngineOptions.AreaViewLocationFormats)),
                    nameof(optionsAccessor));
            }

            _pageFactory = pageFactory;
            _pageActivator = pageActivator;
            _htmlEncoder = htmlEncoder;
            _logger = loggerFactory.CreateLogger<RazorViewEngine>();
            ViewLookupCache = new MemoryCache(new MemoryCacheOptions
            {
                CompactOnMemoryPressure = false
            });
        }
 public AccountController(IConfigurationRoot appSettings, UserManager<ApplicationUser> userManager, SignInManager<ApplicationUser> signInManager, ILoggerFactory loggerFactory)
 {
     _appSettings = appSettings;
     _userManager = userManager;
     _signInManager = signInManager;
     _logger = loggerFactory.CreateLogger<AccountController>();
 }
 public CommandActionsEntryPoint(ICommandManager commandManager, IPresentationManager presentationManager, IPlaybackManager playbackManager, INavigationService navigationService, IScreensaverManager screensaverManager, ILogManager logManager)
 {
     _commandManager = commandManager;
     _defaultCommandActionMap = new DefaultCommandActionMap(presentationManager, playbackManager, navigationService, screensaverManager, logManager);
 
     _logger = logManager.GetLogger(GetType().Name);
 }
 public WebSocketSharpListener(ILogger logger, Action<string> endpointListener,
     string certificatePath)
 {
     _logger = logger;
     _endpointListener = endpointListener;
     _certificatePath = certificatePath;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ProgressiveStreamWriter" /> class.
 /// </summary>
 /// <param name="path">The path.</param>
 /// <param name="logger">The logger.</param>
 /// <param name="fileSystem">The file system.</param>
 public ProgressiveStreamWriter(string path, ILogger logger, IFileSystem fileSystem, TranscodingJob job)
 {
     Path = path;
     Logger = logger;
     _fileSystem = fileSystem;
     _job = job;
 }
 public CollectionManager(ILibraryManager libraryManager, IFileSystem fileSystem, ILibraryMonitor iLibraryMonitor, ILogger logger)
 {
     _libraryManager = libraryManager;
     _fileSystem = fileSystem;
     _iLibraryMonitor = iLibraryMonitor;
     _logger = logger;
 }
 public SensorTelemetry(ILogger logger, IDevice device, AbstractSensor sensor)
 {
     this._logger = logger;
     this._deviceId = device.DeviceID;
     this._sensor = sensor;
     this.TelemetryActive = !string.IsNullOrWhiteSpace(device.HostName) && !string.IsNullOrWhiteSpace(device.PrimaryAuthKey);
 }
 public SendMessageRequestHandler(BrokerController brokerController)
 {
     _brokerController = brokerController;
     _messageService = ObjectContainer.Resolve<IMessageService>();
     _binarySerializer = ObjectContainer.Resolve<IBinarySerializer>();
     _logger = ObjectContainer.Resolve<ILoggerFactory>().Create(GetType().Name);
 }
Exemple #28
0
 public UsageReporter(IApplicationHost applicationHost, IHttpClient httpClient, IUserManager userManager, ILogger logger)
 {
     _applicationHost = applicationHost;
     _httpClient = httpClient;
     _userManager = userManager;
     _logger = logger;
 }
Exemple #29
0
 public EncodingJobFactory(ILogger logger, ILibraryManager libraryManager, IMediaSourceManager mediaSourceManager, IConfigurationManager config)
 {
     _logger = logger;
     _libraryManager = libraryManager;
     _mediaSourceManager = mediaSourceManager;
     _config = config;
 }
 public MultiServerSync(IConnectionManager connectionManager, ILogger logger, ILocalAssetManager userActionAssetManager, IFileTransferManager fileTransferManager)
 {
     _connectionManager = connectionManager;
     _logger = logger;
     _localAssetManager = userActionAssetManager;
     _fileTransferManager = fileTransferManager;
 }