Beispiel #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);
        }
Beispiel #2
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);
        }
Beispiel #3
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);
        }