void AddEventHandlerClass()
        {
            MockClass eventHandlerClass = resolverHelper.CreateClass("EventHandler");

            eventHandlerTargetProperty = eventHandlerClass.AddProperty("Target");
            myClassEvent.ReturnType    = new DefaultReturnType(eventHandlerClass);
        }
Ejemplo n.º 2
0
        void AddNestedPropertyToExistingProperty()
        {
            MockClass nestedPropertyClass = resolverHelper.CreateClass("MyNestedPropertyClass");

            nestedClassProperty        = nestedPropertyClass.AddProperty("MyNestedProperty");
            myClassProperty.ReturnType = new DefaultReturnType(nestedPropertyClass);
        }
Ejemplo n.º 3
0
        void CreateResolver(string code)
        {
            resolverHelper = new PythonResolverTestsHelper(code);

            testClass = resolverHelper.CreateClass("Test.Test1");
            resolverHelper.ProjectContent.ClassesInProjectContent.Add(testClass);
            resolverHelper.ProjectContent.SetClassToReturnFromGetClass("Test.Test1", testClass);
        }
Ejemplo n.º 4
0
        void CreateClassWithOneProperty()
        {
            resolverHelper = new PythonResolverTestsHelper();
            myClass        = resolverHelper.CreateClass("MyClass");
            myClass.AddMethod("MyMethod");

            resolverHelper.ProjectContent.SetClassToReturnFromGetClass("MyClass", myClass);
        }
        void CreateClassWithOneEvent()
        {
            resolverHelper = new PythonResolverTestsHelper();
            myClass        = resolverHelper.CreateClass("MyClass");
            myClassField   = myClass.AddField("MyField");

            resolverHelper.ProjectContent.SetClassToReturnFromGetClass("MyClass", myClass);
        }
Ejemplo n.º 6
0
        void CreateResolver()
        {
            resolverHelper      = new PythonResolverTestsHelper();
            myClass             = resolverHelper.CreateClass("MyClass");
            myMethod            = myClass.AddMethod("MyMethod");
            myMethod.ReturnType = new DefaultReturnType(myClass);

            resolverHelper.ProjectContent.SetClassToReturnFromGetClass("MyClass", myClass);
        }
Ejemplo n.º 7
0
        void CreateClassWithOneProperty()
        {
            resolverHelper  = new PythonResolverTestsHelper();
            myClass         = resolverHelper.CreateClass("MyClass");
            myClassProperty = myClass.AddProperty("MyProperty");

            AddNestedPropertyToExistingProperty();

            resolverHelper.ProjectContent.SetClassToReturnFromGetClass("MyClass", myClass);
        }
        void CreateClassWithOneEvent()
        {
            // Define imports.
            string code =
                "from MyNamespace import MyClass";

            resolverHelper = new PythonResolverTestsHelper(code);
            myClass        = resolverHelper.CreateClass("MyClass");
            myClassEvent   = myClass.AddEvent("MyEvent");

            AddEventHandlerClass();

            resolverHelper.ProjectContent.SetClassToReturnFromGetClass("MyNamespace.MyClass", myClass);
        }
Ejemplo n.º 9
0
        public void Resolve_LocalVariableTypeIsImported_ResolveResultResolvedTypeDeterminedFromImportedTypes()
        {
            string python =
                "from MyNamespace import MyClass\r\n" +
                "\r\n" +
                "a = MyClass()\r\n" +
                "a";

            CreateResolver(python);

            MockClass myClass = resolverHelper.CreateClass("MyNamespace.MyClass");

            resolverHelper.ProjectContent.SetClassToReturnFromGetClass("MyNamespace.MyClass", myClass);

            resolverHelper.Resolve("a", python);

            IReturnType resolvedType    = resolverHelper.LocalResolveResult.ResolvedType;
            IClass      underlyingClass = resolvedType.GetUnderlyingClass();

            Assert.AreEqual(myClass, underlyingClass);
        }