void CreateClassWithOneEvent()
		{
			resolverHelper = new PythonResolverTestsHelper();
			myClass = resolverHelper.CreateClass("MyClass");
			myClassField = myClass.AddField("MyField");
			
			resolverHelper.ProjectContent.SetClassToReturnFromGetClass("MyClass", myClass);
		}
		public void Resolve_FieldHasNoReturnType_DoesNotThrowNullReferenceException()
		{
			MockProjectContent projectContent = new MockProjectContent();
			UnitTestingUtils.MockClass c = new UnitTestingUtils.MockClass(projectContent, "Test");
			projectContent.SetClassToReturnFromGetClass("self", c);
			DefaultField field = c.AddField("randomNumber");
			field.ReturnType = null;
			ParseInformation parseInfo = new ParseInformation(c.CompilationUnit);
			
			ExpressionResult expression = new ExpressionResult("self.randomNumber.randint", ExpressionContext.Default);
			PythonClassResolver classResolver = new PythonClassResolver();
			PythonLocalVariableResolver localVariableResolver = new PythonLocalVariableResolver(classResolver);
			PythonMemberResolver resolver = new PythonMemberResolver(classResolver, localVariableResolver);
			
			PythonResolverContext context = new PythonResolverContext(parseInfo, expression, "class Test:\r\npass");
			Assert.DoesNotThrow(delegate { resolver.Resolve(context); });
		}
Exemple #3
0
        public void Resolve_FieldHasNoReturnType_DoesNotThrowNullReferenceException()
        {
            MockProjectContent projectContent = new MockProjectContent();

            UnitTestingUtils.MockClass c = new UnitTestingUtils.MockClass(projectContent, "Test");
            projectContent.SetClassToReturnFromGetClass("self", c);
            DefaultField field = c.AddField("randomNumber");

            field.ReturnType = null;
            ParseInformation parseInfo = new ParseInformation(c.CompilationUnit);

            ExpressionResult            expression            = new ExpressionResult("self.randomNumber.randint", ExpressionContext.Default);
            PythonClassResolver         classResolver         = new PythonClassResolver();
            PythonLocalVariableResolver localVariableResolver = new PythonLocalVariableResolver(classResolver);
            PythonMemberResolver        resolver = new PythonMemberResolver(classResolver, localVariableResolver);

            PythonResolverContext context = new PythonResolverContext(parseInfo, expression, "class Test:\r\npass");

            Assert.DoesNotThrow(delegate { resolver.Resolve(context); });
        }
Exemple #4
0
		public void AddField_PassedFieldName_ReturnsFieldWithExpectedName()
		{
			MockClass c = new MockClass();
			IField myField = c.AddField("MyField");			
			string name = myField.Name;
			
			Assert.AreEqual("MyField", name);
		}
Exemple #5
0
		public void AddField_PassedFieldName_AddsFieldToClass()
		{
			MockClass c = new MockClass();
			c.AddField("MyField");
			
			IField myField = c.Fields[0];
			string name = myField.Name;
			
			Assert.AreEqual("MyField", name);
		}