public void SerializationTest()
        {
            var pkg = TestPackages.Get();

            var s = new ConfigSerializer();

            XmlSerializer serializer = new XmlSerializer(typeof(GlobalExtractConfiguration));

            using (var writer = new StringWriter())
            {
                serializer.Serialize(writer, s.GetGlobalConfig());
                var g = writer.ToString();
            }
        }
Exemplo n.º 2
0
        private static CompositionContainer GetConfiguredContainer()
        {
            var catalog   = new AggregateCatalog(new AssemblyCatalog(typeof(AppArgs).Assembly), new AssemblyCatalog(typeof(IUnitOfWork).Assembly));
            var container = new CompositionContainer(catalog, true); // thread safe ha!
            var batch     = new CompositionBatch();
            var ser       = new ConfigSerializer();

            batch.AddExportedValue <IAppArgs>(AppArgs.GetAppArgs());
            batch.AddExportedValue <ICanSerializeConfigs>(ser);
            batch.AddExportedValue <IExtractConfiguration>(ser.GetGlobalConfig());
            batch.AddExportedValue <ILog>(new ConsoleLogger());
            batch.AddExportedValue <IFileService>(new FileService());

            container.Compose(batch);

            return(container);
        }