public void Type_PropertyTypeIsSystemString_TypeRefTypeInfoLocationIsExternal()
        {
            CreateCodeProperty2(
                "using System;\r\n" +
                "class MyClass {\r\n" +
                "    public string MyProperty { get; set; }\r\n" +
                "}");

            global::EnvDTE.CodeTypeRef      typeRef  = property.Type;
            global::EnvDTE.vsCMInfoLocation location = typeRef.CodeType.InfoLocation;

            Assert.AreEqual(global::EnvDTE.vsCMInfoLocation.vsCMInfoLocationExternal, location);
        }
        public void CodeType_ReturnTypeFromSameProjectContent_CodeTypeLocationIsProject()
        {
            helper.CreateReturnType("MyType");
            AddUnderlyingClassToReturnType("MyType");
            ReturnTypeSameProjectContent();
            CreateCodeTypeRef2();

            CodeClass2 codeClass = typeRef.CodeType as CodeClass2;

            global::EnvDTE.vsCMInfoLocation location = codeClass.InfoLocation;

            Assert.AreEqual(global::EnvDTE.vsCMInfoLocation.vsCMInfoLocationProject, location);
        }
        public void CodeType_ReturnTypeFromDifferentProjectContent_CodeTypeLocationIsExternal()
        {
            helper.CreateReturnType("System.String");
            AddUnderlyingClassToReturnType("System.String");
            ReturnTypeUsesDifferentProjectContent();
            CreateCodeTypeRef2();

            CodeClass2 codeClass = typeRef.CodeType as CodeClass2;

            global::EnvDTE.vsCMInfoLocation location = codeClass.InfoLocation;

            Assert.AreEqual(global::EnvDTE.vsCMInfoLocation.vsCMInfoLocationExternal, location);
        }
Пример #4
0
        public void CodeType_ReturnTypeFromDifferentAssemblyFromProjectt_CodeTypeLocationIsExternal()
        {
            CreateCodeTypeRef2(
                "using System;\r\n" +
                "class MyClass {\r\n" +
                "    string MyMethod() { return null; }\r\n" +
                "}");

            CodeClass2 codeClass = typeRef.CodeType as CodeClass2;

            global::EnvDTE.vsCMInfoLocation location = codeClass.InfoLocation;

            Assert.AreEqual(global::EnvDTE.vsCMInfoLocation.vsCMInfoLocationExternal, location);
        }
        public void Type_PropertyTypeExistsInProject_TypeRefTypeInfoLocationIsProject()
        {
            CreateCodeProperty2(
                "using System;\r\n" +
                "public class MyClass {\r\n" +
                "    public MyType MyProperty { get; set; }\r\n" +
                "}\r\n" +
                "public class MyType {}");

            global::EnvDTE.CodeTypeRef      typeRef  = property.Type;
            global::EnvDTE.vsCMInfoLocation location = typeRef.CodeType.InfoLocation;

            Assert.AreEqual(global::EnvDTE.vsCMInfoLocation.vsCMInfoLocationProject, location);
        }
Пример #6
0
        public void CodeType_ReturnTypeFromSameProjectContent_CodeTypeLocationIsProject()
        {
            CreateCodeTypeRef2(
                "using System;\r\n" +
                "class MyClass {\r\n" +
                "    MyType MyMethod() { return null; }\r\n" +
                "}\r\n" +
                "class MyType {}");

            CodeClass2 codeClass = typeRef.CodeType as CodeClass2;

            global::EnvDTE.vsCMInfoLocation location = codeClass.InfoLocation;

            Assert.AreEqual(global::EnvDTE.vsCMInfoLocation.vsCMInfoLocationProject, location);
        }
        public void Type_PropertyTypeExistsInProject_TypeRefTypeInfoLocationIsProject()
        {
            helper.CreatePublicProperty("MyProperty");
            helper.SetPropertyReturnType("MyType");
            helper.CreateProjectForProjectContent();
            var classHelper = new ClassHelper();

            classHelper.CreateClass("MyType");
            classHelper.SetProjectForProjectContent(helper.Project);
            helper.ReturnTypeHelper.AddUnderlyingClass(classHelper.Class);
            CreateCodeProperty2();

            global::EnvDTE.CodeTypeRef      typeRef  = property.Type;
            global::EnvDTE.vsCMInfoLocation location = typeRef.CodeType.InfoLocation;

            Assert.AreEqual(global::EnvDTE.vsCMInfoLocation.vsCMInfoLocationProject, location);
        }
        public void Type_PropertyTypeIsSystemString_TypeRefTypeInfoLocationIsExternal()
        {
            helper.CreatePublicProperty("MyProperty");
            helper.SetPropertyReturnType("System.String");
            helper.CreateProjectForProjectContent();
            var classHelper = new ClassHelper();

            classHelper.CreateClass("System.String");
            classHelper.SetProjectForProjectContent(null);
            helper.ReturnTypeHelper.AddUnderlyingClass(classHelper.Class);
            CreateCodeProperty2();

            global::EnvDTE.CodeTypeRef      typeRef  = property.Type;
            global::EnvDTE.vsCMInfoLocation location = typeRef.CodeType.InfoLocation;

            Assert.AreEqual(global::EnvDTE.vsCMInfoLocation.vsCMInfoLocationExternal, location);
        }