コード例 #1
0
        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));
        }
コード例 #2
0
        public void GenerateXml_MoreAssemblies()
        {
            var typeStub1 = MockRepository.GenerateStub<Type> ();
              typeStub1.Stub (t => t.Assembly).Return (_assembly1);

              var typeStub2 = MockRepository.GenerateStub<Type> ();
              typeStub2.Stub (t => t.Assembly).Return (_assembly2);

              var assemblyIdentifierGeneratorStub =
            StubFactory.CreateIdentifierGeneratorStub (new[] { _assembly1, _assembly2 });

              var typeIdentifierGeneratorStub =
            StubFactory.CreateIdentifierGeneratorStub (new[] { typeStub1, typeStub2 });

              var involvedTypes = new[] { new InvolvedType (typeStub1), new InvolvedType (typeStub2) };

              var reportGenerator = new AssemblyReportGenerator (involvedTypes, assemblyIdentifierGeneratorStub, typeIdentifierGeneratorStub);
              var output = reportGenerator.GenerateXml ();

              var expectedOutput = new XElement (
              "Assemblies",
              new XElement (
              "Assembly",
              new XAttribute ("id", "0"),
              new XAttribute ("name", _assembly1.GetName ().Name),
              new XAttribute ("version", _assembly1.GetName ().Version),
              new XAttribute ("location", "./" + Path.GetFileName (_assembly1.Location)),
              new XAttribute ("culture", _assembly1.GetName ().CultureInfo),
              new XAttribute ("publicKeyToken", Convert.ToBase64String (_assembly1.GetName ().GetPublicKeyToken ())),
              new XElement ("InvolvedType-Reference",
                new XAttribute ("ref", typeIdentifierGeneratorStub.GetIdentifier (typeStub1)))),
              new XElement (
              "Assembly",
              new XAttribute ("id", "1"),
              new XAttribute ("name", _assembly2.GetName ().Name),
              new XAttribute ("version", _assembly2.GetName ().Version),
            // _assembly2 is of type object - which is a GAC (mscorlib.dll)
              new XAttribute ("location", _assembly2.Location),
              new XAttribute ("culture", _assembly2.GetName ().CultureInfo),
              new XAttribute ("publicKeyToken", Convert.ToBase64String (_assembly2.GetName ().GetPublicKeyToken ())),
              new XElement ("InvolvedType-Reference",
                new XAttribute ("ref", typeIdentifierGeneratorStub.GetIdentifier (typeStub2)))));

              Assert.That (output.ToString (), Is.EqualTo (expectedOutput.ToString ()));
        }
コード例 #3
0
        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);
        }