Beispiel #1
0
        public void ParseParameter_should_support_type_without_name(TypeName type)
        {
            var s = new SignatureParser(type.FullName + ",");

            s.MoveNext();
            var data = s.ParseParameter();

            Assert.Empty(data.Name);
            Assert.Equal(type, data.Type);
        }
Beispiel #2
0
        public void ParseParameter_should_support_name_without_type(string text)
        {
            var s = new SignatureParser(text);

            s.MoveNext();
            var data = s.ParseParameter();

            Assert.Equal("name", data.Name);
            Assert.Equal(null, data.Type);
        }
Beispiel #3
0
        public void ParseParameter_should_handle_assembly_qualified_type(string text)
        {
            var s = new SignatureParser(text);

            s.MoveNext();
            var data = s.ParseParameter();

            Assert.Equal("x", data.Name);
            Assert.Equal("System.Object", data.Type.FullName);
            Assert.Equal("mscorlib, Version=2.0", data.Type.Assembly.FullName);
        }
Beispiel #4
0
        public void ParseParameter_should_support_colon_type(TypeName type)
        {
            string text = ":" + type.FullName + ",";
            var    s    = new SignatureParser(text);

            s.MoveNext();
            var data = s.ParseParameter();

            Assert.Empty(data.Name);
            Assert.Equal(type, data.Type);
        }
Beispiel #5
0
        public void ParseParameter_should_support_type_space_name(TypeName type)
        {
            string text = type + " " + "name" + ",";
            var    s    = new SignatureParser(text);

            s.MoveNext();
            var data = s.ParseParameter();

            Assert.Equal("name", data.Name);
            Assert.Equal(type, data.Type);
        }
Beispiel #6
0
        public void ParseParameter_should_support_various_formats(TypeName parameterType, string format)
        {
            string text = format.Replace("{type}", parameterType.ToString())
                          .Replace("{name}", "p") + ",";
            var s = new SignatureParser(text);

            s.MoveNext();
            var data = s.ParseParameter();

            Assert.Equal("p", data.Name);
            Assert.Equal(parameterType, data.Type);
        }