Пример #1
0
 public void SingleTypeResolutionForSimpleNamespace()
 {
     RunInCompilerContextEnvironment(() =>
     {
         IType bazType = DefineInternalClass("Foo", "Baz");
         Assert.AreSame(bazType, NamespaceAssert.ResolveQualifiedNameToSingle(_subject.RootNamespace, bazType.FullName));
     });
 }
Пример #2
0
 public void ModuleNamespace()
 {
     RunInCompilerContextEnvironment(() =>
     {
         DefineInternalClass("Foo", "Bar");
         IEntity entity = NamespaceAssert.ResolveSingle(_subject.RootNamespace, "Foo");
         Assert.AreEqual(EntityType.Namespace, entity.EntityType);
     });
 }
Пример #3
0
 public void SingleTypeResolutionAgainstTwoModules()
 {
     RunInCompilerContextEnvironment(() =>
     {
         IType bazType  = DefineInternalClass("Foo.Bar", "Baz");
         IType eggsType = DefineInternalClass("Spam", "Eggs");
         Assert.AreSame(bazType, NamespaceAssert.ResolveQualifiedNameToSingle(_subject.RootNamespace, bazType.FullName));
         Assert.AreSame(eggsType, NamespaceAssert.ResolveQualifiedNameToSingle(_subject.RootNamespace, eggsType.FullName));
     });
 }
        public void RootNamespace()
        {
            ICompileUnit reference = _subject.ForAssembly(GetType().Assembly);
            INamespace   root      = reference.RootNamespace;

            Assert.IsFalse(root.Resolve(new List <IEntity>(), "XXX", EntityType.Any));

            IEntity type = NamespaceAssert.ResolveQualifiedNameToSingle(root, GetType().FullName);

            Assert.AreEqual(EntityType.Type, type.EntityType);
            Assert.AreEqual(type.FullName, GetType().FullName);
        }
Пример #5
0
        public void ModuleNamespaceParent()
        {
            RunInCompilerContextEnvironment(() =>
            {
                DefineInternalClass("Foo.Bar", "Baz");

                var fooNamespace = (INamespace)NamespaceAssert.ResolveSingle(_subject.RootNamespace, "Foo");
                Assert.AreEqual(EntityType.Namespace, fooNamespace.EntityType);
                Assert.AreSame(My <NameResolutionService> .Instance.GlobalNamespace, fooNamespace.ParentNamespace);

                var barNamespace = NamespaceAssert.ResolveSingle(fooNamespace, "Bar");
                Assert.AreEqual(EntityType.Namespace, fooNamespace.EntityType);
                Assert.AreSame(fooNamespace, ((INamespace)barNamespace).ParentNamespace);
            });
        }