Example #1
0
        public void resetting_buffer_many_times_should_not_cause_a_problem()
        {
            var sw = new Stopwatch();

            sw.Start();
            var con = new MockConsole(10, 4);

            for (int i = 0; i < 100; i++)
            {
                con.WriteLine("one");
                con.WriteLine("two");
                con.WriteLine("three");
                con.Write("four");
                con.Clear();
            }
            con.WriteLine("five");
            con.WriteLine("six");
            con.WriteLine("seven");
            con.Write("eight");
            var expected = new[]
            {
                "five",
                "six",
                "seven",
                "eight",
            };

            Assert.AreEqual(expected, con.BufferWrittenTrimmed);
        }
Example #2
0
        public void reset_the_y_position()
        {
            var con = new MockConsole(10, 2);

            Assert.AreEqual(0, con.CursorTop);
            con.WriteLine("one       ");
            con.WriteLine("two       ");
            Assert.AreEqual(1, con.CursorTop);
            con.Clear();
            Assert.AreEqual(0, con.CursorTop);
        }