public void Log_ProviderInitializedWithDebugThresholdThroughConstructor_Succeeds()
        {
            // Arrange
            var expectedMessage = "Hello";
            var provider        = new ConsoleLoggingProvider(LoggingEventType.Debug);

            // Act
            provider.Log(expectedMessage);
        }
        public void Initialize_ConfigurationWithoutDescription_SetsDefaultDescription()
        {
            // Arrange
            var expectedDescription = "Console logging provider";
            var provider            = new ConsoleLoggingProvider();
            var validConfiguration  = CreateValidConfiguration();

            // Act
            provider.Initialize("Valid provider name", validConfiguration);

            // Assert
            Assert.AreEqual(expectedDescription, provider.Description);
        }
        public void Initialize_ConfigurationWithCustomDescription_SetsSpecifiedDescription()
        {
            // Arrange
            var expectedDescription = "My console logger";
            var provider            = new ConsoleLoggingProvider();
            var validConfiguration  = CreateValidConfiguration();

            validConfiguration["description"] = expectedDescription;

            // Act
            provider.Initialize("Valid provider name", validConfiguration);

            // Assert
            Assert.AreEqual(expectedDescription, provider.Description);
        }
Example #4
0
        /// <summary>
        ///     Constructor
        /// </summary>
        /// <param name="threadCount">Number of threads that this CEP will use</param>
        public Processor(int threadCount, int id)
        {
            TimeProvider = new DefaultTimeProvider();
            // var update = new TimedUpdated();
            JobManager      = new SimpleJobManager();
            LoggingProvider = new ConsoleLoggingProvider();
            ID             = id;
            Threads        = new Thread[threadCount];
            HistoricalData = new TestRamDB();
            ObjectPool     = new ObjectPool();

            Express2.BlockFactory = CreateBlockFactory();
            //ScriptsManager = new ScriptManager(@"..\..\..\Dashx.CoreCEP.Scripts\Scripts");

            for (int i = 0; i < threadCount; i++)
            {
                Threads[i]      = new Thread(ServiceLoop);
                Threads[i].Name = "CEP Worker " + i;
                Threads[i].Start();
            }

            Console.WriteLine(" CEPID: {0} - Num Threads: {1}", ID, threadCount);
            //System.Timers.Timer timer1 = new System.Timers.Timer();
            //timer1.Interval = 3000;
            //timer1.Elapsed += new ElapsedEventHandler(PrintQueueSize);
            //timer1.Start();
            ErrorHandler = (block, exception) =>
            {
                if (exception is ThreadAbortException)
                {
                    return(false);
                }
                throw new Exception("*****Error in block: " + block.DebugName + " Exception: " + exception.Message);                //+ "\n\r--\n\r" + exception.StackTrace);
                return(true);
            };
            //  System.Threading.Timer timer1 = new System.Threading.Timer(PrintQueueSize,null,TimeSpan.FromMilliseconds(0),TimeSpan.FromMilliseconds(1000));
        }