Example #1
0
        public async Task TestFeedEvaluation()
        {
            var configmodels = await SourceTestHelper.Instance.GetSourceConfigModels();

            Logger logger;

            using (logger = new Logger("get_feed_article"))
            {
                var sourceStack = new ConcurrentStack <SourceModel>(configmodels);
                var tasks       = new List <Task>();
                for (int i = 0; i < _maxThreads; i++)
                {
                    tasks.Add(TestFeedEvaluationSourceTask(sourceStack, logger));
                }
                await Task.WhenAll(tasks);
            }
            Assert.IsFalse(logger.HasEntryWithFaillure(), "Faillure occurred! Log files at " + logger.GetSavePath());
            Debug.Write("successfull! Log files at " + logger.GetSavePath());
        }
Example #2
0
        public async Task TestSingleSource()
        {
            var sourceToTest = Sources.Blick;
            _maxThreads = 5;
            var configmodels = (await SourceTestHelper.Instance.GetSourceConfigModels()).Where(s => s.Source == sourceToTest);

            Logger logger;
            using (logger = new Logger("get_feed_article"))
            {
                var sourceStack = new ConcurrentStack<SourceModel>(configmodels);
                var tasks = new List<Task>();
                for (int i = 0; i < _maxThreads; i++)
                {
                    tasks.Add(TestFeedEvaluationSourceTask(sourceStack, logger));
                }
                await Task.WhenAll(tasks);
            }
            Assert.IsFalse(logger.HasEntryWithFaillure(), "Faillure occurred! Log files at " + logger.GetSavePath());
            Debug.Write("successfull! Log files at " + logger.GetSavePath());
        }
Example #3
0
        private async Task TestFeedEvaluationSourceTask(ConcurrentStack<SourceModel> sources, Logger logger)
        {
            var assertHelper = new AssertHelper();

            SourceModel source;
            while (sources.TryPop(out source))
            {
                var sourceLogEntry = new LogEntry()
                {
                    Content = "Testing " + source.Name
                };

                var feeds = new ConcurrentStack<FeedModel>(source.Feeds);
                var tasks = new List<Task>();
                for (int i = 0; i < _maxThreads; i++)
                {
                    tasks.Add(TestFeedEvaluationFeedTask(feeds, source, sourceLogEntry, assertHelper));
                }

                await Task.WhenAll(tasks);
                assertHelper.NotAlwaysDefinedPropertiesCheckOut(source.Source);

                logger.AddLog(sourceLogEntry);
            }
        }
Example #4
0
        private async Task TestFeedEvaluationSourceTask(ConcurrentStack <SourceModel> sources, Logger logger)
        {
            var assertHelper = new AssertHelper();

            SourceModel source;

            while (sources.TryPop(out source))
            {
                var sourceLogEntry = new LogEntry()
                {
                    Content = "Testing " + source.Name
                };

                var feeds = new ConcurrentStack <FeedModel>(source.Feeds);
                var tasks = new List <Task>();
                for (int i = 0; i < _maxThreads; i++)
                {
                    tasks.Add(TestFeedEvaluationFeedTask(feeds, source, sourceLogEntry, assertHelper));
                }

                await Task.WhenAll(tasks);

                assertHelper.NotAlwaysDefinedPropertiesCheckOut(source.Source);

                logger.AddLog(sourceLogEntry);
            }
        }