Example #1
0
        public void LookupExpressionBodyProp01()
        {
            var text = @"
class C
{
    public int P => /*<bind>*/10/*</bind>*/;
}";
            var actual = GetExperimentalLookupNames(text).ListToSortedString();

            var expected_lookupNames = new List<string>
            {
                "C",
                "Equals",
                "Finalize",
                "GetHashCode",
                "GetType",
                "MemberwiseClone",
                "Microsoft",
                "P",
                "ReferenceEquals",
                "System",
                "ToString"
            };

            Assert.Equal(expected_lookupNames.ListToSortedString(), actual);
        }
Example #2
0
        public void LookupConstrAndDestr()
        {
            var testSrc = @"
class Test
{
    Test()
    {
    }

    Test(int i)
    {
    }

    ~Test()
    {
    }

    static /*<bind>*/void/*</bind>*/Main()
    {
    }
}
";
            List<string> expected_lookupNames = new List<string>
            {
                "Equals",
                "Finalize",
                "GetHashCode",
                "GetType",
                "Main",
                "MemberwiseClone",
                "Microsoft",
                "ReferenceEquals",
                "System",
                "Test",
                "ToString"
            };

            List<string> expected_lookupSymbols = new List<string>
            {
                "Microsoft",
                "System",
                "System.Boolean System.Object.Equals(System.Object obj)",
                "System.Boolean System.Object.Equals(System.Object objA, System.Object objB)",
                "System.Boolean System.Object.ReferenceEquals(System.Object objA, System.Object objB)",
                "System.Int32 System.Object.GetHashCode()",
                "System.Object System.Object.MemberwiseClone()",
                "void System.Object.Finalize()",
                "System.String System.Object.ToString()",
                "System.Type System.Object.GetType()",
                "void Test.Finalize()",
                "void Test.Main()",
                "Test"
            };

            // Get the list of LookupNames at the location of the CSharpSyntaxNode enclosed within the <bind> </bind> tags
            var actual_lookupNames = GetLookupNames(testSrc);

            // Get the list of LookupSymbols at the location of the CSharpSyntaxNode enclosed within the <bind> </bind> tags
            var actual_lookupSymbols = GetLookupSymbols(testSrc);

            Assert.Equal(expected_lookupNames.ListToSortedString(), actual_lookupNames.ListToSortedString());
            Assert.Equal(expected_lookupSymbols.ListToSortedString(), actual_lookupSymbols.ListToSortedString());
        }
Example #3
0
        public void LookupExpressionBodiedMethod03()
        {
            var text = @"
class C(int i)
{
    public int f = 1;
    public int M(int f) => /*<bind>*/f/*</bind>*/);
}";
            var actual = GetExperimentalLookupNames(text).ListToSortedString();

            var expected_lookupNames = new List<string>
            {
                "C",
                "Equals",
                "f",
                "Finalize",
                "GetHashCode",
                "GetType",
                "MemberwiseClone",
                "Microsoft",
                "M",
                "ReferenceEquals",
                "System",
                "ToString"
            };

            Assert.Equal(expected_lookupNames.ListToSortedString(), actual);
        }