Пример #1
0
        public void Type_MethodReturnsString_TypeRefParentIsCodeFunction()
        {
            CreatePublicFunction("MyClass.MyFunction");
            AddReturnTypeToMethod("System.String");

            global::EnvDTE.CodeTypeRef2 typeRef = codeFunction.Type;

            Assert.AreEqual(codeFunction, typeRef.Parent);
        }
Пример #2
0
        public void Type_MethodReturnsString_TypeRefUsesProjectContentFromMethod()
        {
            CreatePublicFunction("MyClass.MyFunction");
            AddReturnTypeToMethod("System.String");

            global::EnvDTE.CodeTypeRef2 typeRef = codeFunction.Type;

            Assert.AreEqual("string", typeRef.AsString);
        }
Пример #3
0
        public void Type_MethodReturnsString_TypeRefHasSystemStringAsFullName()
        {
            CreatePublicFunction("MyClass.MyFunction");
            AddReturnTypeToMethod("System.String");

            global::EnvDTE.CodeTypeRef2 typeRef = codeFunction.Type;

            Assert.AreEqual("System.String", typeRef.AsFullName);
        }
Пример #4
0
        public void Type_MethodReturnsString_TypeRefParentIsCodeFunction()
        {
            CreateFunction(
                "using System;\r\n" +
                "public class MyClass {\r\n" +
                "    public string MyMethod() {}\r\n" +
                "}");

            global::EnvDTE.CodeTypeRef2 typeRef = codeFunction.Type;

            Assert.AreEqual(codeFunction, typeRef.Parent);
        }
Пример #5
0
        public void Type_MethodReturnsString_TypeRefUsesProjectContentFromMethod()
        {
            CreateFunction(
                "using System;\r\n" +
                "public class MyClass {\r\n" +
                "    public string MyMethod() {}\r\n" +
                "}");

            global::EnvDTE.CodeTypeRef2 typeRef   = codeFunction.Type;
            global::EnvDTE.TextPoint    textPoint = typeRef.CodeType.GetStartPoint();

            Assert.IsNotNull(textPoint);
        }
Пример #6
0
        public void Type_MethodReturnsString_TypeRefHasSystemStringAsFullName()
        {
            CreateFunction(
                "using System;\r\n" +
                "public class MyClass {\r\n" +
                "    public string MyMethod() {}\r\n" +
                "}");

            global::EnvDTE.CodeTypeRef2 typeRef = codeFunction.Type;

            Assert.AreEqual("System.String", typeRef.AsFullName);
            Assert.AreEqual("string", typeRef.AsString);
        }