Ejemplo n.º 1
0
        public void ParseBookFileSpiltForech()
        {
            var Parser = new ParseBookFileSplitForeach();

            var testresult = Parser.countWordsInFile(filepath);

            Assert.IsNotEmpty(testresult);
            Assert.True(testresult.Count == 5677);
        }
Ejemplo n.º 2
0
        public void WriteToFile()
        {
            StreamWriter  writetext = new StreamWriter("write.txt", false);
            StringBuilder builder;

            var Parser = new ParseBookFileSplitForeach();

            var testresult = Parser.countWordsInFile(filepath);

            foreach (var pair in testresult)
            {
                builder = new StringBuilder();
                builder.Append(pair.Key);
                builder.Append(",");
                builder.Append(pair.Value.count);
                builder.Append(",");
                builder.Append(pair.Value.isprime);
                writetext.WriteLine(builder);
            }


            writetext.Close();
        }