private void PrintGeneralStats(Problem[] problems, TextDocument[] documents)
        {
            var tokenizer = Container.Get<ITokenizer>();

            Logger.Log("Total count = {0}", problems.Length);
            //todo: too slow to run every time
            //Logger.Log("Total raw words count = {0}", problems.SelectMany(x => tokenizer.Tokenize(x.RawText)).Distinct().Count());
            //Logger.Log("Total preprocessed words count = {0}", documents.SelectMany(x => x.Words).Distinct().Count());

            PrintDelimeter();
        }
        public void Write()
        {
            var problem1 = new Problem { Id = "id1" };
            var problem2 = new Problem { Id = "id2" };

            using (mocks.Record())
            {
                localStorageHandler.Expect(f => f.Write(string.Format("{0}\\{1}", TestDir, problem1.Id), Filename, problem1));
                localStorageHandler.Expect(f => f.Write(string.Format("{0}\\{1}", TestDir, problem2.Id), Filename, problem2));
            }

            localStorageRepository.Write(problem1, problem2);
        }
        private void PrintRawTagsStats(Problem[] problems)
        {
            var tags = problems.SelectMany(x => x.RawTags).Distinct().ToArray();
            var stats = tags.Select(tag => new TagStatistics
            {
                Name = tag,
                Count = problems.Count(p => p.RawTags.Contains(tag))
            }).ToArray();

            Logger.Log("Raw tags stats");
            foreach (var tag in stats.OrderByDescending(x => x.Count))
            {
                Logger.Log("Tag = {0}, count = {1}", tag.Name, tag.Count);
            }
            PrintDelimeter();
        }
        public void Select()
        {
            var id1 = "id1";
            var id2 = "id2";
            var problem1 = new Problem();
            var problem2 = new Problem();

            using (mocks.Record())
            {
                localStorageHandler.Expect(f => f.Read<Problem>(string.Format("{0}\\{1}", TestDir, id1), Filename)).Return(problem1);
                localStorageHandler.Expect(f => f.Read<Problem>(string.Format("{0}\\{1}", TestDir, id2), Filename)).Return(problem2);
            }

            var actuals = localStorageRepository.Select(id1, id2);
            CollectionAssert.AreEquivalent(new[] { problem1, problem2 }, actuals);
        }
        public void SelectAll()
        {
            var dir1 = "dir1";
            var dir2 = "dir2";
            var problem1 = new Problem();
            var problem2 = new Problem();

            using (mocks.Record())
            {
                localStorageHandler.Expect(f => f.GetDirectories(TestDir)).Return(new[] { dir1, dir2 });
                localStorageHandler.Expect(f => f.Read<Problem>(dir1, Filename)).Return(problem1);
                localStorageHandler.Expect(f => f.Read<Problem>(dir2, Filename)).Return(problem2);
            }

            var actuals = localStorageRepository.SelectAll();
            CollectionAssert.AreEquivalent(new[] { problem1, problem2 }, actuals);
        }