public void GenerateXml_ZeroInterfaces()
        {
            var involvedType    = new InvolvedType(typeof(object));
            var reportGenerator = new InterfaceReferenceReportGenerator(involvedType, new IdentifierGenerator <Type>(), Helpers.RemotionReflectorFactory.GetRemotionReflection());

            var output = reportGenerator.GenerateXml();

            var expectedOutput = new XElement("ImplementedInterfaces");

            Assert.That(output.ToString(), Is.EqualTo(expectedOutput.ToString()));
        }
        public void GenerateXml_WithInterfaces()
        {
            // TargetClass1 implements IDisposealbe
            var involvedType    = new InvolvedType(typeof(TargetClass1));
            var reportGenerator = new InterfaceReferenceReportGenerator(involvedType, new IdentifierGenerator <Type>(), Helpers.RemotionReflectorFactory.GetRemotionReflection());

            var output = reportGenerator.GenerateXml();

            var expectedOutput = new XElement(
                "ImplementedInterfaces",
                new XElement("ImplementedInterface", new XAttribute("ref", "0"))
                );

            Assert.That(output.ToString(), Is.EqualTo(expectedOutput.ToString()));
        }
        public void GenerateXml_WithComposedInterface()
        {
            var mixinConfiguration = MixinConfiguration.BuildNew()
                                     .ForClass <ComposedInterfacesTestClass.MyMixinTarget>()
                                     .AddCompleteInterface <ComposedInterfacesTestClass.ICMyMixinTargetMyMixin>()
                                     .AddMixin <ComposedInterfacesTestClass.MyMixin>()
                                     .BuildConfiguration();

            // MyMixinTarget does not implement any interfaces! (but ICMyMixinTargetMyMixin is added to class context as a composed interface)
            var involvedType = new InvolvedType(typeof(ComposedInterfacesTestClass.MyMixinTarget));
            var classContext = mixinConfiguration.ClassContexts.GetWithInheritance(typeof(ComposedInterfacesTestClass.MyMixinTarget));

            involvedType.ClassContext = new ReflectedObject(classContext);

            var reportGenerator = new InterfaceReferenceReportGenerator(involvedType, new IdentifierGenerator <Type>(), Helpers.RemotionReflectorFactory.GetRemotionReflection());
            var output          = reportGenerator.GenerateXml();

            var expectedOutput = new XElement(
                "ImplementedInterfaces",
                new XElement("ImplementedInterface", new XAttribute("ref", "0"))
                );

            Assert.That(output.ToString(), Is.EqualTo(expectedOutput.ToString()));
        }