예제 #1
0
        public void Format_NoEncoding_WithHotkey()
        {
            var formatter      = new UnderscoreHotkeyFormatter();
            var textWithHotkey = new TextWithHotkey("foo bar", 4);

            Assert.That(formatter.FormatText(textWithHotkey, false), Is.EqualTo("foo <u>b</u>ar"));
        }
예제 #2
0
        public void FormatText_NoEncoding_WithHotkeyAtStart()
        {
            var formatter      = new TestableHotkeyFormatterBase();
            var textWithHotkey = new TextWithHotkey("foo bar", 0);

            Assert.That(formatter.FormatText(textWithHotkey, false), Is.EqualTo("<x 'f'>f</x>oo bar"));
        }
예제 #3
0
        public void FormatText_WithHtmlEncoding_NoHotkey()
        {
            var formatter      = new TestableHotkeyFormatterBase();
            var textWithHotkey = new TextWithHotkey("f<b>o</b>o b&ar", null);

            Assert.That(formatter.FormatText(textWithHotkey, true), Is.EqualTo("f&lt;b&gt;o&lt;/b&gt;o b&amp;ar"));
        }
예제 #4
0
        public void FormatText_NoEncoding_WithHotkey()
        {
            var formatter      = new TestableHotkeyFormatterBase();
            var textWithHotkey = new TextWithHotkey("foo b&ar", 4);

            Assert.That(formatter.FormatText(textWithHotkey, false), Is.EqualTo("foo <x 'b'>b</x>&ar"));
        }
예제 #5
0
        public void FormatHotkey_LowerCaseHotkey_MakesUpperCase()
        {
            var formatter      = new TestableHotkeyFormatterBase();
            var textWithHotkey = new TextWithHotkey("text", 'a');

            Assert.That(formatter.FormatHotkey(textWithHotkey), Is.EqualTo("A"));
        }
예제 #6
0
        public void FormatText_NoEncoding_NoHotkey()
        {
            var formatter      = new TestableHotkeyFormatterBase();
            var textWithHotkey = new TextWithHotkey("f<b>o</b>o b&ar", null);

            Assert.That(formatter.FormatText(textWithHotkey, false), Is.EqualTo("f<b>o</b>o b&ar"));
        }
예제 #7
0
        public void FormatHotkey_NoHotkey()
        {
            var formatter      = new TestableHotkeyFormatterBase();
            var textWithHotkey = new TextWithHotkey("text", null);

            Assert.That(formatter.FormatHotkey(textWithHotkey), Is.Null);
        }
예제 #8
0
        public void FormatText_WithHtmlEncoding_WithEncodedHotkey()
        {
            var formatter      = new TestableHotkeyFormatterBase();
            var textWithHotkey = new TextWithHotkey("foo öar", 4);

            Assert.That(formatter.FormatText(textWithHotkey, true), Is.EqualTo("foo <x '&#246;'>&#246;</x>ar"));
        }
예제 #9
0
        public void FormatText_NoEncoding_WithHotkeyAtEnd()
        {
            var formatter      = new TestableHotkeyFormatterBase();
            var textWithHotkey = new TextWithHotkey("foo bar", 6);

            Assert.That(formatter.FormatText(textWithHotkey, false), Is.EqualTo("foo ba<x 'r'>r</x>"));
        }
        public void Initialize_WithTextEmpty_AndHotkey()
        {
            var textWithHotkey = new TextWithHotkey("", 'X');

            Assert.That(textWithHotkey.Text, Is.Empty);
            Assert.That(textWithHotkey.HotkeyIndex, Is.Null);
            Assert.That(textWithHotkey.Hotkey, Is.EqualTo('X'));
        }
        public void Initialize_WithText_AndHotkeyIndexNull()
        {
            var textWithHotkey = new TextWithHotkey("foo bar", null);

            Assert.That(textWithHotkey.Text, Is.EqualTo("foo bar"));
            Assert.That(textWithHotkey.HotkeyIndex, Is.Null);
            Assert.That(textWithHotkey.Hotkey, Is.Null);
        }
예제 #12
0
        protected override void Render(HtmlTextWriter writer)
        {
            _textWithHotkey = HotkeyParser.Parse(Text);

            base.Render(writer);
        }