示例#1
0
        public void TestMethodKeywordCompletionWhenTyping()
        {
            var codeCompletionServices = new CodeCompletionServices(libraryServicesCore);
            string code = "im";
            var completions = codeCompletionServices.SearchCompletions(code, System.Guid.Empty);

            // Expected 5 completion items
            Assert.AreEqual(5, completions.Count());

            string[] expected = { "Decimal", "Imperative", "ImportFromCSV", "Minimal", "MinimalTracedClass" };
            var actual = completions.Select(x => x.Text).OrderBy(x => x);

            Assert.AreEqual(expected, actual);
        }
示例#2
0
        public void TestHiddenConflictingClassCompletionWhenTyping()
        {
            var codeCompletionServices = new CodeCompletionServices(libraryServicesCore);

            // "SecondNamespace.AnotherClassWithNameConflict" is defined in FFITarget library with "IsVisibleInDynamoLibrary" 
            // attribute set to false. We verify that this class does not appear in code completion results
            // and that only "FirstNamespace.AnotherClassWithNameConflict" appears in code completion results with
            // fully qualified name so that it can be resolved against "SecondNamespace.AnotherClassWithNameConflict" 
            string code = "ano";
            var completions = codeCompletionServices.SearchCompletions(code, Guid.Empty);

            // Expected 1 completion items
            Assert.AreEqual(1, completions.Count());

            string[] expected = { "AnotherClassWithNameConflict" };
            var actual = completions.Select(x => x.Text).OrderBy(x => x);

            Assert.AreEqual(expected, actual);

            // Assert that the class name is indeed a class
            ClassMirror type = null;
            Assert.DoesNotThrow(() => type = new ClassMirror("FirstNamespace.AnotherClassWithNameConflict", libraryServicesCore));

            var members = type.GetMembers();

            expected = new[] { "AnotherClassWithNameConflict", "PropertyA", "PropertyB", "PropertyC" };
            AssertCompletions(members, expected);
        }
示例#3
0
        public void TestCompletionWhenTyping()
        {
            var codeCompletionServices = new CodeCompletionServices(libraryServicesCore);
            string code = "Poi";
            var completions = codeCompletionServices.SearchCompletions(code, System.Guid.Empty);

            // Expected 4 completion items
            Assert.AreEqual(4, completions.Count());

            string[] expected = {"DummyPoint", "FFITarget.DesignScript.Point",
                                    "FFITarget.Dynamo.Point", "UnknownPoint"};
            var actual = completions.Select(x => x.Text).OrderBy(x => x);

            Assert.AreEqual(expected, actual);
        }
示例#4
0
        public void TestHiddenClassCompletionWhenTyping()
        {
            var codeCompletionServices = new CodeCompletionServices(libraryServicesCore);

            // "SampleClassB" defined in FFITarget library with "IsVisibleInDynamoLibrary" attribute
            // is set to false. We verify that this class does not appear in code completion results
            string code = "sam";
            var completions = codeCompletionServices.SearchCompletions(code, Guid.Empty);

            // Expected 2 completion items
            Assert.AreEqual(2, completions.Count());

            string[] expected = { "SampleClassA", "SampleClassC" };
            var actual = completions.Select(x => x.Text).OrderBy(x => x);

            Assert.AreEqual(expected, actual);
        }