public void UnknownIdentifierTest() { UnknownIdentifierResolveResult uirr = (UnknownIdentifierResolveResult)resolver.ResolveSimpleName("xyz", new IType[0]); Assert.IsTrue(uirr.IsError); Assert.AreEqual("xyz", uirr.Identifier); }
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); }
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); }
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); }