Beispiel #1
0
        public void ParseDeclaringTypeOpt_should_extract_implied_generic_nested()
        {
            var s = new SignatureParser("System.Collections.Generic.Dictionary`2.ValueCollection.Method(");

            s.MoveNext();
            string name;
            var    data = s.ParseDeclaringTypeOpt(out name);

            Assert.Equal("Method", name);
            Assert.Equal("System.Collections.Generic.Dictionary`2+ValueCollection", data.FullName);
            Assert.Equal(TokenType.LeftParen, s.Type);
        }
Beispiel #2
0
        public void ParseTypeWithSpecifiers_type_parameters_given_name()
        {
            var s = new SignatureParser("Hello`1<W,X>");

            s.MoveNext();
            var t = s.ParseTypeWithSpecifiers();

            Assert.Equal("Hello`2", t.Name);
            Assert.HasCount(2, t.GenericParameters);
            Assert.Equal("W", t.GenericParameters[0].Name);
            Assert.Equal("X", t.GenericParameters[1].Name);
        }
Beispiel #3
0
        public void ParseDeclaringTypeOpt_should_extract_declaring(string declaring)
        {
            var s = new SignatureParser(declaring + ".World[");

            s.MoveNext();
            string name;
            var    data = s.ParseDeclaringTypeOpt(out name);

            Assert.Equal(declaring, data.FullName);
            Assert.Equal("World", name);
            Assert.Equal(TokenType.LeftBracket, s.Type);
        }
Beispiel #4
0
        public void ParseTypeWithSpecifiers_type_args()
        {
            var s = new SignatureParser("Hello<W,X>");

            s.MoveNext();
            var t = s.ParseTypeWithSpecifiers();

            Assert.Equal("Hello`2", t.Name);
            var gargs = ((GenericInstanceTypeName)t).GenericArguments;

            Assert.HasCount(2, gargs);
            Assert.Equal("W", gargs[0].Name);
            Assert.Equal("X", gargs[1].Name);
        }