예제 #1
0
        public void IntellisenseBox_OnPreviewKeyDown_GivenI_Hit_Enter_Key_And_AlloInsertLine_Is_True_Should_AddLine()
        {
            var mockPresentationSource = new Mock <PresentationSource>();
            var textBox = new Mock <TextBox>();

            textBox.Object.MinLines = 5;
            textBox.Object.Text     = "Var";
            var testHelper = new IntellisenseTextBoxTestHelper
            {
                AllowUserInsertLine = true,
                TextBox             = textBox.Object,
                MinLines            = textBox.Object.MinLines
            };

            testHelper.OnPreviewKeyDown(new KeyEventArgs(Keyboard.PrimaryDevice, mockPresentationSource.Object, 0, Key.Enter));
            Assert.IsFalse(testHelper.HasError);
        }
예제 #2
0
        public void IntellisenseBox_OnPreviewKeyDown_GivenI_Hit_Tab_Key_Should_AppendText()
        {
            var mockPresentationSource = new Mock <PresentationSource>();
            var textBox = new Mock <TextBox>();

            textBox.Object.MinLines = 5;
            var givenText = textBox.Object.Text = "Var";

            Assert.IsFalse(givenText.Contains("\r\n"));
            var testHelper = new IntellisenseTextBoxTestHelper
            {
                AllowUserInsertLine = true,
                TextBox             = textBox.Object,
                IsDropDownOpen      = true,
            };

            testHelper.OnPreviewKeyDown(new KeyEventArgs(Keyboard.PrimaryDevice, mockPresentationSource.Object, 0, Key.Tab));
            Assert.IsFalse(testHelper.HasError);
            Assert.IsFalse(testHelper.TextBox.Text.Contains("\r\n"));
        }
예제 #3
0
        public void IntellisenseBox_OnPreviewKeyDown_Given_EnterKey_And_AllowInsertLineIsTrueButLineCountIsEqualToMaximumLine_ShouldNotAddLine()
        {
            var mockPresentationSource = new Mock <PresentationSource>();
            var textBox = new Mock <TextBox>();

            textBox.Object.MinLines = 5;
            var givenText = textBox.Object.Text = "Var";

            Assert.IsFalse(givenText.Contains("\r\n"));
            var testHelper = new IntellisenseTextBoxTestHelper
            {
                AllowUserInsertLine = true,
                TextBox             = textBox.Object,
                MinLines            = textBox.Object.MinLines,
                LineCount           = 5
            };

            testHelper.OnPreviewKeyDown(new KeyEventArgs(Keyboard.PrimaryDevice, mockPresentationSource.Object, 0, Key.Enter));
            Assert.IsFalse(testHelper.HasError);
            Assert.IsFalse(testHelper.TextBox.Text.Contains("\r\n"));
        }