public void UsingRequires() { TypeGraphSpace graph = new TypeGraphSpace(); graph.AddAssemblyReference("mscorlib"); graph.AddAssemblyReference("System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); TypeGraphSpace sub = new TypeGraphSpace(graph); sub.AddRequire("System"); sub.AddRequire("System::Diagnostics"); TypeDefinition type = sub.GetType("Console"); Assert.IsNotNull(type); Assert.AreEqual("Console", type.Name); type = sub.GetType("System::Console"); Assert.IsNotNull(type); Assert.AreEqual("Console", type.Name); type = sub.GetType("Debug"); Assert.IsNotNull(type); Assert.AreEqual("Debug", type.Name); type = sub.GetType("System::Diagnostics::Debug"); Assert.IsNotNull(type); Assert.AreEqual("Debug", type.Name); }
public void AddingAssembly() { TypeGraphSpace graph = new TypeGraphSpace(); graph.AddAssemblyReference("mscorlib"); graph.AddAssemblyReference("System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); NamespaceGraph ng = graph.GetNamespace("System"); Assert.IsNotNull(ng); Assert.AreEqual("System", ng.Name); ng = graph.GetNamespace("System::Collections::Specialized"); Assert.IsNotNull(ng); Assert.AreEqual("Specialized", ng.Name); ng = graph.GetNamespace("System::Diagnostics"); Assert.IsNotNull(ng); Assert.AreEqual("Diagnostics", ng.Name); }
public void CheckAmbiguities() { TypeGraphSpace graph = new TypeGraphSpace(); graph.AddAssemblyReference("mscorlib"); graph.AddAssemblyReference("System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); graph.AddAssemblyReference("Castle.Rook.Compiler.Tests"); TypeGraphSpace sub = new TypeGraphSpace(graph); sub.AddRequire("System"); sub.AddRequire("Castle::Rook::Compiler::Tests"); Assert.IsFalse(sub.HasAmbiguity("System::Console")); TypeDefinition type = sub.GetType("System::Console"); Assert.IsNotNull(type); Assert.AreEqual("Console", type.Name); Assert.IsTrue(sub.HasAmbiguity("Console")); }
public RootSymbolTable() : base(ScopeType.Global) { graphSpace = new TypeGraphSpace(); graphSpace.AddAssemblyReference("mscorlib"); }