public void IntellisenseSelectionTest()
        {
            RexISM.Enter_Typing();
            RexISM.Code = "Math.P";
            RexISM.Update();
            Assert.AreEqual(RexInputState.Typing, RexISM.State);
            Assert.IsTrue(RexISM.DisplayHelp);
            Assert.IsNotEmpty(RexISM.IntelliSenceHelp);
            Assert.AreEqual(RexISM.SelectedHelp, -1);

            PressKey(KeyCode.DownArrow);
            Assert.AreEqual(RexInputState.IntelliSelect, RexISM.State);
            Assert.AreEqual(RexISM.SelectedHelp, 0);

            RexISM.Enter_Typing();
            Assert.AreEqual(RexInputState.Typing, RexISM.State);
            Assert.AreEqual(RexISM.SelectedHelp, -1);

            RexISM.Code = "x = Math.";
            RexISM.Update();
            PressKey(KeyCode.DownArrow);
            Assert.AreEqual(RexInputState.IntelliSelect, RexISM.State);
            Assert.AreEqual(RexISM.SelectedHelp, 0);


            PressKey(KeyCode.DownArrow);
            Assert.AreEqual(RexInputState.IntelliSelect, RexISM.State);
            Assert.AreEqual(RexISM.SelectedHelp, 1);

            PressKey(KeyCode.Return);
            Assert.IsTrue(RexISM.Code.Contains("x = Math."));
        }
        void TestIntelliSelect(string code, IEnumerable <string> selections, bool withMethodOverloads = true)
        {
            RexISM.Enter_Typing();
            RexISM.Code = code;
            RexISM.Update();
            Assert.AreEqual(RexInputState.Typing, RexISM.State);
            Assert.IsTrue(RexISM.DisplayHelp);

            var help = RexISM.IntelliSenceHelp.Where(i => !i.IsMethodOverload);
            var meth = RexISM.IntelliSenceHelp.Where(i => i.IsMethodOverload);

            Assert.IsNotEmpty(help);
            if (withMethodOverloads)
            {
                Assert.IsNotEmpty(meth);
            }
            else
            {
                Assert.IsEmpty(meth);
            }

            Assert.AreEqual(-1, RexISM.SelectedHelp);
            var count = 0;

            foreach (var select in selections)
            {
                PressKey(KeyCode.DownArrow);
                Assert.AreEqual(select, RexISM.ReplacementString(), "At i = " + count);
                Assert.AreEqual(count++, RexISM.SelectedHelp);
            }
        }
 public void IntellisenseTest()
 {
     RexISM.Enter_Typing();
     RexISM.Code = "Math.P";
     RexISM.Update();
     Assert.AreEqual(RexInputState.Typing, RexISM.State);
     Assert.IsTrue(RexISM.DisplayHelp);
     Assert.IsNotEmpty(RexISM.IntelliSenceHelp);
 }
        public void UpdateTest()
        {
            Assert.AreEqual(RexInputState.NoInput, RexISM.State);

            RexISM.Update();
            Assert.AreEqual(RexInputState.NoInput, RexISM.State);

            RexISM.Enter_Typing();
            Assert.AreEqual(RexInputState.Typing, RexISM.State);
            Assert.IsTrue(RexISM.DisplayHelp);

            RexISM.Update();
            Assert.AreEqual(RexInputState.Typing, RexISM.State);
            Assert.IsTrue(RexISM.DisplayHelp);

            PressKey(KeyCode.Escape);
            RexISM.Update();
            Assert.AreEqual(RexInputState.Typing, RexISM.State);
            Assert.IsFalse(RexISM.DisplayHelp);
            Assert.IsEmpty(RexISM.IntelliSenceHelp);
        }