コード例 #1
0
        public void should_handle_line_breaks(string text, int expectedLines)
        {
            var writer = new ConsoleStatWriter();

            Console.SetOut(writer);

            Console.Write(text);

            Assert.Equal(expectedLines, writer.Lines);
        }
コード例 #2
0
        public void should_redirect_and_stat()
        {
            var writer = new ConsoleStatWriter();

            Console.SetOut(writer);

            Console.WriteLine("hello");
            Console.WriteLine("world");

            Assert.Equal(3, writer.Lines);
        }
コード例 #3
0
        public void should_handle_huge_amount_of_text_data()
        {
            var statWriter = new ConsoleStatWriter();
            int totalLines = ushort.MaxValue;
            var writer     = new HugeConsoleWriter(totalLines, statWriter);

            Stopwatch watch = Stopwatch.StartNew();

            writer.Write();
            watch.Stop();

            output.WriteLine($"Elapsed Time: {watch.Elapsed:c}");

            Assert.Equal(totalLines, statWriter.Lines);
        }
コード例 #4
0
        public void should_set_initial_lines()
        {
            var writer = new ConsoleStatWriter();

            Assert.Equal(0, writer.Lines);
        }