Exemplo n.º 1
0
        public void AssemblyNodeNamespacesHaveFilteredTypes()
        {
            var node = new AssemblyNode(typeof(TestAssembly1.Namespace1.Class1).Assembly, this, t => !t.Name.Contains("Internal"));

            Assert.AreEqual(1, node.Namespaces.Count);
            Assert.AreEqual(2, node.Namespaces[0].Types.Count);
            Assert.AreSame(typeof(TestAssembly1.Namespace1.Class1), node.Namespaces[0].Types[0].Data);
            Assert.AreSame(typeof(TestAssembly1.Namespace1.Class2), node.Namespaces[0].Types[1].Data);
        }
Exemplo n.º 2
0
        public void AssemblyNodeIsInitialized()
        {
            var node = new AssemblyNode(typeof(TestAssembly1.Namespace1.Class1).Assembly, this, null);

            Assert.AreEqual("TestAssembly1", node.DisplayName);
            Assert.AreEqual(2, node.Namespaces.Count);
            Assert.AreEqual(Visibility.Visible, node.Visibility);
            Assert.IsFalse(node.IsExpanded);
            Assert.IsFalse(node.IsSelected);
        }
Exemplo n.º 3
0
        public void AssemblyNodeNamespacesHaveTypes()
        {
            var node = new AssemblyNode(typeof(TestAssembly1.Namespace1.Class1).Assembly, this, null);

            Assert.AreEqual(3, node.Namespaces[0].Types.Count);
            Assert.AreSame(typeof(TestAssembly1.Namespace1.Class1), node.Namespaces[0].Types[0].Data);
            Assert.AreSame(typeof(TestAssembly1.Namespace1.Class2), node.Namespaces[0].Types[1].Data);
            Assert.AreEqual("TestAssembly1.Namespace1.InternalClass1", node.Namespaces[0].Types[2].Data.FullName);
            Assert.AreEqual(1, node.Namespaces[1].Types.Count);
            Assert.AreEqual("TestAssembly1.Namespace2.AnotherInternalClass", node.Namespaces[1].Types[0].Data.FullName);
        }
        public void WhenIncludingAssemblyWithMissingReferences_ThenLoadsTypesWithAvailableReferences()
        {
            var nodeCreatorMock = new Mock<INodeCreator>(MockBehavior.Strict);

            nodeCreatorMock
                .Setup(nc => nc.CreateNamespaceNode("TypeLoadTestAssembly"))
                .Returns<string>(ns => new NamespaceNode(ns))
                .Verifiable();

            nodeCreatorMock
                .Setup(nc => nc.CreateTypeNode(typeof(DerivedFromObject)))
                .Returns<Type>(t => new TypeNode(t))
                .Verifiable();

            var namespaces = new AssemblyNode(typeof(DerivedFromObject).Assembly, nodeCreatorMock.Object, t => true).Namespaces;

            nodeCreatorMock.VerifyAll();
        }