예제 #1
0
        public void PrintDoubleLetterStatistic_RusVowel()
        {
            var ms     = new MemoryStream();
            var writer = new StreamWriter(ms);

            writer.Write("ДвойныыеБууквыУУу");
            writer.Flush();

            ms.Seek(0, SeekOrigin.Begin);

            var reader   = new ReadOnlyStream(ms);
            var analyzer = new LetterAnalyzer(reader);
            var printer  = new LetterPrinterToList();

            analyzer.PrintDoubleLetterStatistic(printer, CharType.Vowel);

            var oneLetter = printer.lettersPrintered[0];

            Assert.AreEqual('Ы', oneLetter.Letter);
            Assert.AreEqual(1, oneLetter.Count);

            oneLetter = printer.lettersPrintered[1];
            Assert.AreEqual('У', oneLetter.Letter);
            Assert.AreEqual(2, oneLetter.Count);
        }
예제 #2
0
        public void PrintSingleLetterStatistic_Eng()
        {
            var ms     = new MemoryStream();
            var writer = new StreamWriter(ms);

            writer.Write("aicaiiBifB");
            writer.Flush();

            ms.Seek(0, SeekOrigin.Begin);

            var reader   = new ReadOnlyStream(ms);
            var analyzer = new LetterAnalyzer(reader);
            var printer  = new LetterPrinterToList();

            analyzer.PrintSingleLetterStatistic(printer, CharType.Vowel);

            var oneLetter = printer.lettersPrintered[0];

            Assert.AreEqual('a', oneLetter.Letter);
            Assert.AreEqual(2, oneLetter.Count);

            oneLetter = printer.lettersPrintered[1];
            Assert.AreEqual('i', oneLetter.Letter);
            Assert.AreEqual(4, oneLetter.Count);
        }
예제 #3
0
        public void PrintSingleLetterStatistic_SkipNumber()
        {
            var ms     = new MemoryStream();
            var writer = new StreamWriter(ms);

            writer.Write("aica123");
            writer.Flush();

            ms.Seek(0, SeekOrigin.Begin);

            var reader   = new ReadOnlyStream(ms);
            var analyzer = new LetterAnalyzer(reader);
            var printer  = new LetterPrinterToList();

            analyzer.PrintSingleLetterStatistic(printer, CharType.Consonants);

            Assert.AreEqual(1, printer.lettersPrintered.Count);
        }
예제 #4
0
        public void PrintDoubleLetterStatistic_NotDouble()
        {
            var ms     = new MemoryStream();
            var writer = new StreamWriter(ms);

            writer.Write("A1A");
            writer.Flush();

            ms.Seek(0, SeekOrigin.Begin);

            var reader   = new ReadOnlyStream(ms);
            var analyzer = new LetterAnalyzer(reader);
            var printer  = new LetterPrinterToList();

            analyzer.PrintDoubleLetterStatistic(printer, CharType.Vowel);

            Assert.AreEqual(0, printer.lettersPrintered.Count);
        }
예제 #5
0
        public void PrintSingleLetterStatistic_EngRemoveNotConsonants()
        {
            var ms     = new MemoryStream();
            var writer = new StreamWriter(ms);

            writer.Write("aicaiiBifB");
            writer.Flush();

            ms.Seek(0, SeekOrigin.Begin);

            var reader   = new ReadOnlyStream(ms);
            var analyzer = new LetterAnalyzer(reader);
            var printer  = new LetterPrinterToList();

            analyzer.PrintSingleLetterStatistic(printer, CharType.Consonants);

            var oneLetter = printer.lettersPrintered[0];

            Assert.AreEqual(3, printer.lettersPrintered.Count);
        }
예제 #6
0
        public void PrintSingleLetterStatistic_RusVowel()
        {
            var ms     = new MemoryStream();
            var writer = new StreamWriter(ms);

            writer.Write("ПриведМедвед");
            writer.Flush();

            ms.Seek(0, SeekOrigin.Begin);

            var reader   = new ReadOnlyStream(ms);
            var analyzer = new LetterAnalyzer(reader);
            var printer  = new LetterPrinterToList();

            analyzer.PrintSingleLetterStatistic(printer, CharType.Vowel);

            var oneLetter = printer.lettersPrintered[1];

            Assert.AreEqual('е', oneLetter.Letter);
            Assert.AreEqual(3, oneLetter.Count);
        }
예제 #7
0
        public void PrintDoubleLetterStatistic_SkipSpace()
        {
            var ms     = new MemoryStream();
            var writer = new StreamWriter(ms);

            writer.Write("шш  ШШ  ");
            writer.Flush();

            ms.Seek(0, SeekOrigin.Begin);

            var reader   = new ReadOnlyStream(ms);
            var analyzer = new LetterAnalyzer(reader);
            var printer  = new LetterPrinterToList();

            analyzer.PrintDoubleLetterStatistic(printer, CharType.Consonants);

            var oneLetter = printer.lettersPrintered[0];

            Assert.AreEqual('Ш', oneLetter.Letter);
            Assert.AreEqual(2, oneLetter.Count);
            Assert.AreEqual(1, printer.lettersPrintered.Count);
        }