public void GenerateXml_DifferentAssemblies() { var involvedType1 = new InvolvedType(typeof(TargetClass1)) { ClassContext = new ReflectedObject(new ClassContext(typeof(TargetClass1))) }; var involvedType2 = new InvolvedType(typeof(object)); var reportGenerator = CreateInvolvedTypeReportGenerator(involvedType1, involvedType2); var output = reportGenerator.GenerateXml(); var expectedOutput = new XElement( "InvolvedTypes", new XElement( "InvolvedType", new XAttribute("id", "0"), new XAttribute("assembly-ref", "0"), new XAttribute("namespace", "MixinXRef.UnitTests.TestDomain"), new XAttribute("name", "TargetClass1"), new XAttribute("base", "Object"), new XAttribute("base-ref", "1"), new XAttribute("is-target", true), new XAttribute("is-mixin", false), new XAttribute("is-unusedmixin", false), new XAttribute("is-generic-definition", false), new XAttribute("is-interface", false), _outputFormatter.CreateModifierMarkup("", _typeModifierUtility.GetTypeModifiers(involvedType1.Type)), _summaryPicker.GetSummary(involvedType1.Type), new MemberReportGenerator(involvedType1.Type, involvedType1, _involvedTypeIdentifierGenerator, _memberIdentifierGenerator, _outputFormatter). GenerateXml(), new InterfaceReferenceReportGenerator(involvedType1, _interfaceIdentifierGenerator, _remotionReflector).GenerateXml(), new AttributeReferenceReportGenerator(involvedType1.Type, _attributeIdentifierGenerator, _remotionReflector).GenerateXml(), new MixinReferenceReportGenerator( involvedType1, _assemblyIdentifierGenerator, _readOnlyInvolvedTypeIdentifierGenerator, _interfaceIdentifierGenerator, _attributeIdentifierGenerator, _remotionReflector, _outputFormatter). GenerateXml(), new TargetReferenceReportGenerator(involvedType1, _readOnlyInvolvedTypeIdentifierGenerator).GenerateXml() ), new XElement( "InvolvedType", new XAttribute("id", "1"), new XAttribute("assembly-ref", "1"), new XAttribute("namespace", "System"), new XAttribute("name", "Object"), new XAttribute("base", "none"), new XAttribute("base-ref", "none"), new XAttribute("is-target", false), new XAttribute("is-mixin", false), new XAttribute("is-unusedmixin", false), new XAttribute("is-generic-definition", false), new XAttribute("is-interface", false), _outputFormatter.CreateModifierMarkup("", _typeModifierUtility.GetTypeModifiers(involvedType2.Type)), _summaryPicker.GetSummary(involvedType2.Type), new MemberReportGenerator(involvedType2.Type, involvedType2, _involvedTypeIdentifierGenerator, _memberIdentifierGenerator, _outputFormatter). GenerateXml(), new InterfaceReferenceReportGenerator(involvedType2, _interfaceIdentifierGenerator, _remotionReflector).GenerateXml(), new AttributeReferenceReportGenerator(involvedType2.Type, _attributeIdentifierGenerator, _remotionReflector).GenerateXml(), new MixinReferenceReportGenerator( involvedType2, _assemblyIdentifierGenerator, _readOnlyInvolvedTypeIdentifierGenerator, _interfaceIdentifierGenerator, _attributeIdentifierGenerator, _remotionReflector, _outputFormatter). GenerateXml(), new TargetReferenceReportGenerator(involvedType2, _readOnlyInvolvedTypeIdentifierGenerator).GenerateXml() )); XElementComparisonHelper.Compare(output, expectedOutput); }
public void GenerateXml_InvolvedTypes() { var mixinConfiguration = MixinConfiguration.BuildNew() .ForClass <TargetClass1> ().AddMixin <Mixin1> () .ForClass <TargetClass2> ().AddMixin <Mixin2> () .BuildConfiguration(); var involvedType1 = new InvolvedType(typeof(TargetClass1)); involvedType1.ClassContext = new ReflectedObject(mixinConfiguration.ClassContexts.First()); SetTargetClassDefinition(involvedType1, mixinConfiguration); var involvedType2 = new InvolvedType(typeof(TargetClass2)); involvedType2.ClassContext = new ReflectedObject(mixinConfiguration.ClassContexts.Last()); SetTargetClassDefinition(involvedType2, mixinConfiguration); var involvedType3 = new InvolvedType(typeof(Mixin1)); involvedType3.TargetTypes.Add(new InvolvedType(typeof(TargetClass1)), null); var involvedType4 = new InvolvedType(typeof(Mixin2)); involvedType4.TargetTypes.Add(new InvolvedType(typeof(TargetClass2)), null); var reportGenerator = CreateInvolvedTypeReportGenerator(involvedType1, involvedType2, involvedType3, involvedType4); var output = reportGenerator.GenerateXml(); var expectedOutput = new XElement( "InvolvedTypes", new XElement( "InvolvedType", new XAttribute("id", "0"), new XAttribute("assembly-ref", "0"), new XAttribute("namespace", "MixinXRef.UnitTests.TestDomain"), new XAttribute("name", "TargetClass1"), new XAttribute("base", "Object"), new XAttribute("base-ref", "none"), new XAttribute("is-target", true), new XAttribute("is-mixin", false), new XAttribute("is-unusedmixin", false), new XAttribute("is-generic-definition", false), new XAttribute("is-interface", false), _outputFormatter.CreateModifierMarkup("", _typeModifierUtility.GetTypeModifiers(involvedType1.Type)), _summaryPicker.GetSummary(involvedType1.Type), new MemberReportGenerator(involvedType1.Type, involvedType1, _involvedTypeIdentifierGenerator, _memberIdentifierGenerator, _outputFormatter). GenerateXml(), new InterfaceReferenceReportGenerator(involvedType1, _interfaceIdentifierGenerator, _remotionReflector).GenerateXml(), new AttributeReferenceReportGenerator(involvedType1.Type, _attributeIdentifierGenerator, _remotionReflector).GenerateXml(), new MixinReferenceReportGenerator( involvedType1, _assemblyIdentifierGenerator, _readOnlyInvolvedTypeIdentifierGenerator, _interfaceIdentifierGenerator, _attributeIdentifierGenerator, _remotionReflector, _outputFormatter). GenerateXml(), new TargetReferenceReportGenerator(involvedType1, _readOnlyInvolvedTypeIdentifierGenerator).GenerateXml() ), new XElement( "InvolvedType", new XAttribute("id", "1"), new XAttribute("assembly-ref", "0"), new XAttribute("namespace", "MixinXRef.UnitTests.TestDomain"), new XAttribute("name", "TargetClass2"), new XAttribute("base", "Object"), new XAttribute("base-ref", "none"), new XAttribute("is-target", true), new XAttribute("is-mixin", false), new XAttribute("is-unusedmixin", false), new XAttribute("is-generic-definition", false), new XAttribute("is-interface", false), _outputFormatter.CreateModifierMarkup("", _typeModifierUtility.GetTypeModifiers(involvedType2.Type)), _summaryPicker.GetSummary(involvedType2.Type), new MemberReportGenerator(involvedType2.Type, involvedType2, _involvedTypeIdentifierGenerator, _memberIdentifierGenerator, _outputFormatter). GenerateXml(), new InterfaceReferenceReportGenerator(involvedType2, _interfaceIdentifierGenerator, _remotionReflector).GenerateXml(), new AttributeReferenceReportGenerator(involvedType2.Type, _attributeIdentifierGenerator, _remotionReflector).GenerateXml(), new MixinReferenceReportGenerator( involvedType2, _assemblyIdentifierGenerator, _readOnlyInvolvedTypeIdentifierGenerator, _interfaceIdentifierGenerator, _attributeIdentifierGenerator, _remotionReflector, _outputFormatter). GenerateXml(), new TargetReferenceReportGenerator(involvedType2, _readOnlyInvolvedTypeIdentifierGenerator).GenerateXml() ), new XElement( "InvolvedType", new XAttribute("id", "2"), new XAttribute("assembly-ref", "0"), new XAttribute("namespace", "MixinXRef.UnitTests.TestDomain"), new XAttribute("name", "Mixin1"), new XAttribute("base", "Object"), new XAttribute("base-ref", "none"), new XAttribute("is-target", false), new XAttribute("is-mixin", true), new XAttribute("is-unusedmixin", false), new XAttribute("is-generic-definition", false), new XAttribute("is-interface", false), _outputFormatter.CreateModifierMarkup("", _typeModifierUtility.GetTypeModifiers(involvedType3.Type)), _summaryPicker.GetSummary(involvedType3.Type), new MemberReportGenerator(involvedType3.Type, involvedType3, _involvedTypeIdentifierGenerator, _memberIdentifierGenerator, _outputFormatter). GenerateXml(), new InterfaceReferenceReportGenerator(involvedType3, _interfaceIdentifierGenerator, _remotionReflector).GenerateXml(), new AttributeReferenceReportGenerator(involvedType3.Type, _attributeIdentifierGenerator, _remotionReflector).GenerateXml(), new MixinReferenceReportGenerator( involvedType3, _assemblyIdentifierGenerator, _readOnlyInvolvedTypeIdentifierGenerator, _interfaceIdentifierGenerator, _attributeIdentifierGenerator, _remotionReflector, _outputFormatter). GenerateXml(), new TargetReferenceReportGenerator(involvedType3, _readOnlyInvolvedTypeIdentifierGenerator).GenerateXml() ), new XElement( "InvolvedType", new XAttribute("id", "3"), new XAttribute("assembly-ref", "0"), new XAttribute("namespace", "MixinXRef.UnitTests.TestDomain"), new XAttribute("name", "Mixin2"), new XAttribute("base", "Object"), new XAttribute("base-ref", "none"), new XAttribute("is-target", false), new XAttribute("is-mixin", true), new XAttribute("is-unusedmixin", false), new XAttribute("is-generic-definition", false), new XAttribute("is-interface", false), _outputFormatter.CreateModifierMarkup("", _typeModifierUtility.GetTypeModifiers(involvedType4.Type)), _summaryPicker.GetSummary(involvedType4.Type), new MemberReportGenerator(involvedType4.Type, involvedType4, _involvedTypeIdentifierGenerator, _memberIdentifierGenerator, _outputFormatter). GenerateXml(), new InterfaceReferenceReportGenerator(involvedType4, _interfaceIdentifierGenerator, _remotionReflector).GenerateXml(), new AttributeReferenceReportGenerator(involvedType4.Type, _attributeIdentifierGenerator, _remotionReflector).GenerateXml(), new MixinReferenceReportGenerator( involvedType4, _assemblyIdentifierGenerator, _readOnlyInvolvedTypeIdentifierGenerator, _interfaceIdentifierGenerator, _attributeIdentifierGenerator, _remotionReflector, _outputFormatter). GenerateXml(), new TargetReferenceReportGenerator(involvedType4, _readOnlyInvolvedTypeIdentifierGenerator).GenerateXml() ) ); XElementComparisonHelper.Compare(output, expectedOutput); }