コード例 #1
0
        public void IgnoreActionTest()
        {
            var tv = new TextViewer();

            tv.Actions.Clear();
            tv.Actions.Add(Action.CreateIgnoreAction("foo"));

            tv.AddEvent("bar", new FileListener());
            Assert.AreEqual("bar\n", tv.Txt.Text);
            tv.AddEvent("foo", new FileListener());
            Assert.AreEqual("bar\n", tv.Txt.Text);
            tv.AddEvent("bar", new FileListener());
            Assert.AreEqual("bar\nbar\n", tv.Txt.Text);
        }
コード例 #2
0
        public void BufferEnforcementTestOverrun()
        {
            var tv = new TextViewer();

            tv.Txt.Clear();
            var bs = 11;

            tv.BufferSize = bs;

            for (var i = 0; i < bs; i++)
            {
                tv.AddEvent(i.ToString(), new FileListener());
            }
            //It seems that there is an empty line att the end if the 'last' line ends with a NewLine
            Assert.LessOrEqual(tv.Txt.TextLength, bs, "There should be less or equal amount characters ass the buffer size. With an occational newline to much.");
        }
コード例 #3
0
        public void BufferEnforcementTestExactLineCount()
        {
            var tv = new TextViewer();

            tv.Txt.Clear();
            var bs = 10;

            tv.BufferSize = bs;

            for (var i = 0; i < bs - 1; i++)
            {
                tv.AddEvent(i.ToString(), new FileListener());
                //It seems that there is an empty line att the end if the 'last' line ends with a NewLine
                Assert.Less(tv.Txt.Lines.Length, 7,
                            "There should be less than seven lines since the buffer is 10 characters");
            }
        }