public Parser_PathToSeriesFile(ITestOutputHelper output) : base(output)
 {
     // arrange
     _logger   = Output.BuildLoggerFor <SceneNameParser>();
     _filename = "My.Show.S01E01.1080p.BDRIP.SCENE-REPACK.mkv";
     _parser   = new SceneNameParser(_logger);
 }
示例#2
0
 public PluginLoaderTests(ITestOutputHelper output)
 {
     _logger        = output.BuildLoggerFor <IPluginLoader>();
     _path          = FindPluginsDir();
     _pluginOptions = new PluginOptions
     {
         Directories = new DirectoryInfo[] { _path }
     };
 }
示例#3
0
        public RedisStore(IRedisFactory redisFactory, ICacheConfig cacheConfig, ICacheLogger cacheLogger)
        {
            this._cacheConfig = cacheConfig;
            this._cacheLogger = cacheLogger;
            long index = (typeof(T).FullName.Select(c => Convert.ToInt64(c)).Aggregate((cur, next) => cur + next)) % 16;

            this._cacheLogger.LogAsync($"Connecting to RedisDB:{index}", System.Diagnostics.Tracing.EventLevel.Verbose);
            this.DB = redisFactory.Connection?.GetDatabase((int)index);
        }
示例#4
0
 public RenameCommand_PathToSeriesFile(ITestOutputHelper output)
 {
     // arrange
     _output  = output;
     _logger  = _output.BuildLoggerFor <Console.Commands.Rename.Command>();
     _options = new Console.Commands.Rename.Options
     {
         Path = "~/downloads/My.Show.S01.E01.Episode.Title.1080p.BDRIP.SCENE-REPACK",
     };
     _renamer = A.Fake <IRenameFoldersAndFiles>();
     _command = new Console.Commands.Rename.Command(_logger, _renamer);
 }
示例#5
0
        public PackageManagerTests(ITestOutputHelper output)
        {
            _logger = output.BuildLoggerFor <IPackageManager>();

            _cacheDir = new DirectoryInfo(".packs");
            if (_cacheDir.Exists)
            {
                _cacheDir.Delete(true);
                _cacheDir.Create();
            }

            _webClient = new HttpClient();
        }
示例#6
0
        public Renamer_PathToSeriesFile(ITestOutputHelper output)
        {
            _output     = output;
            _logger     = _output.BuildLoggerFor <Renamer.Renamer>();
            _folders    = A.Fake <IRenameFolders>();
            _files      = A.Fake <IRenameFiles>();
            _filesystem = new System.IO.Abstractions.TestingHelpers.MockFileSystem(new Dictionary <string, MockFileData>
            {
                { "/home/ken/downloads/My.Show.S01.E01.Episode.Title.1080p.BDRIP.SCENE-REPACK", new MockFileData("1234567890") },
            }, "");

            _renamer = new Renamer.Renamer(_logger, _folders, _files, _filesystem);
            Path     = "/home/ken/downloads/My.Show.S01.E01.Episode.Title.1080p.BDRIP.SCENE-REPACK";
        }
示例#7
0
        public ServiceBusChannel(ICacheConfig cacheConfig, ICacheLogger logger)
        {
            _cacheConfig      = cacheConfig;
            _cacheLogger      = logger;
            _managementClient = new ManagementClient(_cacheConfig.ServiceBusConnectionString);
            if (_managementClient.TopicExistsAsync(_cacheConfig.CacheBackPlaneChannel).GetAwaiter().GetResult() == false)
            {
                _managementClient.CreateTopicAsync(_cacheConfig.CacheBackPlaneChannel);
            }
            if (_managementClient.SubscriptionExistsAsync(_cacheConfig.CacheBackPlaneChannel, _cacheConfig.ListenerInstanceId).GetAwaiter().GetResult() == false)
            {
                _managementClient.CreateSubscriptionAsync(_cacheConfig.CacheBackPlaneChannel, _cacheConfig.ListenerInstanceId);
            }

            _topicClient = new TopicClient(_cacheConfig.ServiceBusConnectionString, _cacheConfig.CacheBackPlaneChannel, _cacheConfig.RetryPolicy);
            _taskPool    = new ConcurrentDictionary <string, Task>();
        }
示例#8
0
 public CommunicationChannelFactory(ICacheConfig cacheConfig, ICacheLogger logger)
 {
     this._cacheConfig      = cacheConfig;
     this._cacheLogger      = logger;
     this.channelCollection = new List <ICommunicationChannel>();
     if (this._cacheConfig.IsRabbitCommnunicationChannelEnabled)
     {
         RmqChannel item = new RmqChannel(this._cacheConfig, this._cacheLogger);
         item.Subscribe();
         this.channelCollection.Add(item);
     }
     if (this._cacheConfig.IsServiceBusCommnunicationChannelEnabled)
     {
         ServiceBusChannel item1 = new ServiceBusChannel(this._cacheConfig, this._cacheLogger);
         item1.Subscribe();
         this.channelCollection.Add(item1);
     }
 }
示例#9
0
 public CacheProviderV1(IStoreCollectionProvider <T> storeCollectionProvider,
                        ICacheConfig cacheConfig,
                        IBackPlane backPlane,
                        ICacheLogger logger,
                        IBaseCacheContextManager cacheContextManager)
 {
     this._cacheLogger          = logger;
     this._cacheContextManager  = cacheContextManager;
     this._cacheStoreCollection = storeCollectionProvider.GetCacheStoreCollection();
     this.minStoreIndex         = 0;
     this.maxStoreIndex         = this._cacheStoreCollection.Count;
     this._cacheConfig          = cacheConfig;
     this.FilterName            = typeof(T).FullName;
     this._backPlane            = backPlane;
     this._nonLockingRuntimeWrapperForCallBacks = new NonLockingRuntimeWrapper <T>(this._cacheLogger);
     if (this._cacheConfig.BackPlaneEnabled)
     {
         this._backPlane.SubscribeToBackPlanEvents <T>(this.FilterName, this.OnBackPlaneEvent);
     }
     this._cacheLogger = logger;
 }
示例#10
0
        public RmqChannel(ICacheConfig cacheConfig, ICacheLogger logger)
        {
            this._cacheConfig       = cacheConfig;
            this._cacheLogger       = logger;
            this._connectionFactory = new ConnectionFactory()
            {
                HostName    = cacheConfig.RabbitConnection.HostName,
                UserName    = cacheConfig.RabbitConnection.UserName,
                Password    = cacheConfig.RabbitConnection.Password,
                Port        = cacheConfig.RabbitConnection.Port,
                VirtualHost = cacheConfig.RabbitConnection.VirtualHost
            };
            if (this._cacheConfig.RabbitConnection.IsSSlEnabled)
            {
                SslOption sslOption = new SslOption
                {
                    Enabled                = true,
                    ServerName             = cacheConfig.RabbitConnection.HostName,
                    AcceptablePolicyErrors = SslPolicyErrors.RemoteCertificateNameMismatch |
                                             SslPolicyErrors.RemoteCertificateChainErrors,
                };

                this._connectionFactory.Ssl = sslOption;
            }
            this._connection = this._connectionFactory.CreateConnection();

            this._subscriptionClient = this._connection.CreateModel();
            this._subscriptionClient.QueueDeclare(queue: this._cacheConfig.ListenerInstanceId,
                                                  durable: false,
                                                  exclusive: false,
                                                  autoDelete: false);
            this._eventingBasicConsumer = new EventingBasicConsumer(this._subscriptionClient);
            this._topicClient           = this._connection.CreateModel();
            this._topicClient.ExchangeDeclare(exchange: this._cacheConfig.CacheBackPlaneChannel,
                                              type: "fanout",
                                              durable: false,
                                              autoDelete: false);
        }
示例#11
0
 public BaseBackPlane(ICommunicationChannelFactory channelFactory, ICacheLogger logger, ICacheConfig cacheConfig)
 {
     this._cacheLogger       = logger;
     this._cacheConfig       = cacheConfig;
     this.ListenerInstanceId = this._cacheConfig.ListenerInstanceId;
     this._channels          = new ConcurrentDictionary <string, ICommunicationChannel>();
     this._onEventHandlers   = new ConcurrentDictionary <string, ConcurrentDictionary <string, Action <EventMessage> > >();
     if (_cacheConfig.BackPlaneEnabled == true)
     {
         foreach (ICommunicationChannel item in channelFactory.GetActiveChannels())
         {
             if (this._channels.TryAdd(item.ChannelUid, item))
             {
                 this._channels[item.ChannelUid].OnMessage = this.OnEvent;
                 this._cacheLogger.LogAsync($"Bindng to Communication Channel {item.ChannelUid} Completed", EventLevel.Verbose);
             }
             else
             {
                 this._cacheLogger.LogAsync($"Bindng to Communication Channel {item.ChannelUid} Failed", EventLevel.Error);
             }
         }
     }
     this._cacheLogger.LogAsync("Bindng to Communication Channels Completed", EventLevel.Verbose);
 }
 public TestsTests(ITestOutputHelper output)
 {
     _logger = output.BuildLogger();
 }
 public StoreCollectionProvider(IRedisFactory redisFactory, ICacheConfig cacheConfig, ICacheLogger cacheLogger)
 {
     this._redisFactory = redisFactory;
     this._cacheConfig  = cacheConfig;
     this._cacheLogger  = cacheLogger;
 }
示例#14
0
 public NonLockingRuntimeWrapper(ICacheLogger cacheLogger)
 {
     this._cacheLogger = cacheLogger;
     this.Name         = typeof(T).FullName;
 }
示例#15
0
 public LoggerExtensionsTests(ITestOutputHelper output)
 {
     _logger = output.BuildLogger();
 }
示例#16
0
 public InMemStore(ICacheConfig cacheConfig, ICacheLogger cacheLogger)
 {
     this._cacheConfig = cacheConfig;
     this._cacheLogger = cacheLogger;
 }
示例#17
0
 public RepoControllerEndpointTests(ITestOutputHelper output,
                                    ConfiguringWebApplicationFactory <Startup> factory)
     : base(output, factory)
 {
     _logger = Output.BuildLogger();
 }
示例#18
0
 public MapboxClientTest(ITestOutputHelper iTestOutputHelper)
 {
     Logger = iTestOutputHelper.BuildLogger();
 }