示例#1
0
        public void UnknownIdentifierTest()
        {
            UnknownIdentifierResolveResult uirr = (UnknownIdentifierResolveResult)resolver.ResolveSimpleName("xyz", new IType[0]);

            Assert.IsTrue(uirr.IsError);
            Assert.AreEqual("xyz", uirr.Identifier);
        }
示例#2
0
		public void AliasToImportedType()
		{
			var resolverWithUsing = resolver.WithCurrentUsingScope(MakeUsingScope(usings: new [] { "System" }, usingAliases: new [] { new KeyValuePair<string, string>( "x", "String" )}));
			UnknownIdentifierResolveResult rr = (UnknownIdentifierResolveResult)resolverWithUsing.ResolveSimpleName("x", new IType[0]);
			// Unknown identifier (as String isn't looked up in System)
			Assert.AreEqual("String", rr.Identifier);
		}
示例#3
0
		public void UnknownTypeTest()
		{
			string program = @"class A {
	void Method($StringBuilder$ b) {
	}
}
";
			UnknownIdentifierResolveResult result = Resolve<UnknownIdentifierResolveResult>(program);
			Assert.AreEqual("StringBuilder", result.Identifier);
			
			Assert.AreSame(SpecialType.UnknownType, result.Type);
		}
示例#4
0
        public void NonExistingClassTypeName()
        {
            string program = @"class A {
	void Method() {
		var a = new $ThisClassDoesNotExist$();
	}
}
";
            UnknownIdentifierResolveResult result = Resolve <UnknownIdentifierResolveResult>(program);

            Assert.AreEqual("ThisClassDoesNotExist", result.Identifier);
            Assert.AreSame(SpecialType.UnknownType, result.Type);
        }