public void GenerateXml_NoErrors()
        {
            var errorAggregator = new ErrorAggregator<Exception>();
              var reportGenerator = new ConfigurationErrorReportGenerator (errorAggregator);

              var output = reportGenerator.GenerateXml();
              var expectedOutput = new XElement ("ConfigurationErrors");

              Assert.That (output.ToString(), Is.EqualTo (expectedOutput.ToString()));
        }
        private CompositeReportGenerator CreateCompositeReportGenerator()
        {
            var assemblyIdentifierGenerator            = new IdentifierGenerator <Assembly>();
            var readOnlyassemblyIdentifierGenerator    = assemblyIdentifierGenerator.GetReadonlyIdentiferGenerator("none");
            var readonlyInvolvedTypeIdentiferGenerator =
                new IdentifierPopulator <Type> (_involvedTypes.Select(it => it.Type)).GetReadonlyIdentifierGenerator("none");
            var memberIdentifierGenerator   = new IdentifierGenerator <MemberInfo> ();
            var interfaceIdentiferGenerator = new IdentifierGenerator <Type>();
            var attributeIdentiferGenerator = new IdentifierGenerator <Type>();

            var involvedReport = new InvolvedTypeReportGenerator(
                _involvedTypes,
                assemblyIdentifierGenerator,
                readonlyInvolvedTypeIdentiferGenerator,
                memberIdentifierGenerator,
                interfaceIdentiferGenerator,
                attributeIdentiferGenerator,
                _remotionReflector,
                _outputFormatter);
            var interfaceReport = new InterfaceReportGenerator(
                _involvedTypes,
                assemblyIdentifierGenerator,
                readonlyInvolvedTypeIdentiferGenerator,
                memberIdentifierGenerator,
                interfaceIdentiferGenerator,
                _remotionReflector,
                _outputFormatter);
            var attributeReport = new AttributeReportGenerator(
                _involvedTypes,
                assemblyIdentifierGenerator,
                readonlyInvolvedTypeIdentiferGenerator,
                attributeIdentiferGenerator,
                _remotionReflector,
                _outputFormatter);
            var assemblyReport = new AssemblyReportGenerator(_involvedTypes, readOnlyassemblyIdentifierGenerator, readonlyInvolvedTypeIdentiferGenerator);

            var configurationErrorReport = new ConfigurationErrorReportGenerator(_configurationErrors);
            var validationErrorReport    = new ValidationErrorReportGenerator(_validationErrors, _remotionReflector);

            return(new CompositeReportGenerator(
                       involvedReport,
                       interfaceReport,
                       attributeReport,
                       assemblyReport,
                       configurationErrorReport,
                       validationErrorReport));
        }
        public void GenerateXml_WithErrors()
        {
            var errorAggregator = new ErrorAggregator<Exception>();

              var innerException1 = SetUpExceptionWithDummyStackTrace ("inner exception", null);
              var Exception1 = SetUpExceptionWithDummyStackTrace ("test configuration exception 1", innerException1);
              var Exception2 = SetUpExceptionWithDummyStackTrace ("test configuration excpetion 2", null);

              errorAggregator.AddException (Exception1);
              errorAggregator.AddException (Exception2);
              var reportGenerator = new ConfigurationErrorReportGenerator (errorAggregator);

              var output = reportGenerator.GenerateXml();
              var expectedOutput = new XElement (
              "ConfigurationErrors",
              new RecursiveExceptionReportGenerator (Exception1).GenerateXml(),
              new RecursiveExceptionReportGenerator (Exception2).GenerateXml()
              );

              Assert.That (output.ToString(), Is.EqualTo (expectedOutput.ToString()));
        }
        private CompositeReportGenerator CreateCompositeReportGenerator()
        {
            var assemblyIdentifierGenerator = new IdentifierGenerator<Assembly>();
              var readOnlyassemblyIdentifierGenerator = assemblyIdentifierGenerator.GetReadonlyIdentiferGenerator ("none");
              var readonlyInvolvedTypeIdentiferGenerator =
              new IdentifierPopulator<Type> (_involvedTypes.Select (it => it.Type)).GetReadonlyIdentifierGenerator ("none");
              var memberIdentifierGenerator = new IdentifierGenerator<MemberInfo> ();
              var interfaceIdentiferGenerator = new IdentifierGenerator<Type>();
              var attributeIdentiferGenerator = new IdentifierGenerator<Type>();

              var involvedReport = new InvolvedTypeReportGenerator (
              _involvedTypes,
              assemblyIdentifierGenerator,
              readonlyInvolvedTypeIdentiferGenerator,
              memberIdentifierGenerator,
              interfaceIdentiferGenerator,
              attributeIdentiferGenerator,
              _remotionReflector,
              _outputFormatter);
              var interfaceReport = new InterfaceReportGenerator (
              _involvedTypes,
              assemblyIdentifierGenerator,
              readonlyInvolvedTypeIdentiferGenerator,
              memberIdentifierGenerator,
              interfaceIdentiferGenerator,
              _remotionReflector,
              _outputFormatter);
              var attributeReport = new AttributeReportGenerator (
              _involvedTypes,
              assemblyIdentifierGenerator,
              readonlyInvolvedTypeIdentiferGenerator,
              attributeIdentiferGenerator,
              _remotionReflector,
              _outputFormatter);
              var assemblyReport = new AssemblyReportGenerator (_involvedTypes, readOnlyassemblyIdentifierGenerator, readonlyInvolvedTypeIdentiferGenerator);

              var configurationErrorReport = new ConfigurationErrorReportGenerator (_configurationErrors);
              var validationErrorReport = new ValidationErrorReportGenerator (_validationErrors, _remotionReflector);

              return new CompositeReportGenerator (
              involvedReport,
              interfaceReport,
              attributeReport,
              assemblyReport,
              configurationErrorReport,
              validationErrorReport);
        }