Represents a collecting proxy definition visitor.
Наследование: IProxyDefinitionVisitor
        public void AcceptVisitorTest()
        {
            // Arrange
            var proxyDefinition = new InterfaceProxyDefinition(typeof (IOne), new[] {typeof (ITwo), typeof (IOneTwo)});

            // Act
            var proxyDefinitionVisitor = new CollectingProxyDefinitionVisitor();

            proxyDefinition.AcceptVisitor(proxyDefinitionVisitor);

            // Assert
            Assert.That(proxyDefinition.DeclaringType, Is.EqualTo(typeof (IOne)));
            Assert.That(proxyDefinition.ParentType, Is.EqualTo(typeof (object)));
            Assert.That(proxyDefinition.ImplementedInterfaces.Count(), Is.EqualTo(4));
            Assert.That(proxyDefinition.ImplementedInterfaces, Contains.Item(typeof (IBase)));
            Assert.That(proxyDefinition.ImplementedInterfaces, Contains.Item(typeof (IOne)));
            Assert.That(proxyDefinition.ImplementedInterfaces, Contains.Item(typeof (ITwo)));
            Assert.That(proxyDefinition.ImplementedInterfaces, Contains.Item(typeof (IOneTwo)));
            Assert.That(proxyDefinitionVisitor.InterfaceTypes.Count, Is.EqualTo(4));
            Assert.That(proxyDefinitionVisitor.InterfaceTypes, Contains.Item(typeof (IBase)));
            Assert.That(proxyDefinitionVisitor.InterfaceTypes, Contains.Item(typeof (IOne)));
            Assert.That(proxyDefinitionVisitor.InterfaceTypes, Contains.Item(typeof (ITwo)));
            Assert.That(proxyDefinitionVisitor.InterfaceTypes, Contains.Item(typeof (IOneTwo)));

            Assert.That(proxyDefinitionVisitor.ConstructorInfos.Count, Is.EqualTo(1));

            Assert.That(proxyDefinitionVisitor.EventInfos.Count, Is.EqualTo(3));

            Assert.That(proxyDefinitionVisitor.PropertyInfos.Count, Is.EqualTo(6));

            Assert.That(proxyDefinitionVisitor.MethodInfos.Count, Is.EqualTo(7));
        }
Пример #2
0
        public void AcceptVisitorTest()
        {
            // Arrange
            var proxyDefinition = new DelegateProxyDefinition(typeof(Action), new[] { typeof(IOne), typeof(ITwo), typeof(IOneTwo) });

            // Act
            var proxyDefinitionVisitor = new CollectingProxyDefinitionVisitor();

            proxyDefinition.AcceptVisitor(proxyDefinitionVisitor);

            // Assert
            Assert.That(proxyDefinition.DeclaringType, Is.EqualTo(typeof(Action)));
            Assert.That(proxyDefinition.ParentType, Is.EqualTo(typeof(object)));
            Assert.That(proxyDefinition.ImplementedInterfaces.Count(), Is.EqualTo(4));
            Assert.That(proxyDefinition.ImplementedInterfaces, Contains.Item(typeof(IBase)));
            Assert.That(proxyDefinition.ImplementedInterfaces, Contains.Item(typeof(IOne)));
            Assert.That(proxyDefinition.ImplementedInterfaces, Contains.Item(typeof(ITwo)));
            Assert.That(proxyDefinition.ImplementedInterfaces, Contains.Item(typeof(IOneTwo)));
            Assert.That(proxyDefinitionVisitor.InterfaceTypes.Count, Is.EqualTo(4));
            Assert.That(proxyDefinitionVisitor.InterfaceTypes, Contains.Item(typeof(IBase)));
            Assert.That(proxyDefinitionVisitor.InterfaceTypes, Contains.Item(typeof(IOne)));
            Assert.That(proxyDefinitionVisitor.InterfaceTypes, Contains.Item(typeof(ITwo)));
            Assert.That(proxyDefinitionVisitor.InterfaceTypes, Contains.Item(typeof(IOneTwo)));

            Assert.That(proxyDefinitionVisitor.ConstructorInfos.Count, Is.EqualTo(1));

            Assert.That(proxyDefinitionVisitor.EventInfos.Count, Is.EqualTo(3));

            Assert.That(proxyDefinitionVisitor.PropertyInfos.Count, Is.EqualTo(6));

            Assert.That(proxyDefinitionVisitor.MethodInfos.Count, Is.EqualTo(8));
        }