コード例 #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());
        }
コード例 #2
0
ファイル: ArticleTests.cs プロジェクト: famoser/OfflineMedia
        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());
        }
コード例 #3
0
ファイル: ArticleTests.cs プロジェクト: famoser/OfflineMedia
        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);
            }
        }
コード例 #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);
            }
        }