Exemplo n.º 1
0
        public void DoubleProviderTestCloudToXml()
        {
            EmptyDirectory(Path.Combine(Environment.CurrentDirectory, "..\\..\\..\\Target Files"));

            Configurator configurator = new Configurator();

            ConcreteMediator <string, string> m = new ConcreteMediator <string, string>();

            CloudReaderProvider ReaderProvider = new CloudReaderProvider(m);

            configurator.ConfigureSourcePath(ReaderProvider, Path.Combine("cloudPath", "\\cloudDirectory"));
            configurator.ConfigureUserName(ReaderProvider, "testUser");
            configurator.ConfigurePassword(ReaderProvider, "testPassword");
            configurator.ConfigureUrl(ReaderProvider, "cloudUrl");

            XmlWriterProvider xmlWriter = new XmlWriterProvider(m);

            configurator.ConfigureDestinationPath(xmlWriter, Path.Combine(Environment.CurrentDirectory, "..\\..\\..\\Target Files\\Document1.xml"));


            DoubleProvider <string, string> doubleProvider = new DoubleProvider <string, string>(ReaderProvider, xmlWriter, m);

            doubleProvider.Process();

            Assert.IsTrue(File.Exists(Path.Combine(Environment.CurrentDirectory, "..\\..\\..\\Target Files\\Document1.xml")));
        }
Exemplo n.º 2
0
        public void DoubleProviderTestJsonToXml()
        {
            EmptyDirectory(Path.Combine(Environment.CurrentDirectory, "..\\..\\..\\Target Files"));

            Configurator configurator = new Configurator();

            ConcreteMediator <string, string> m = new ConcreteMediator <string, string>();

            JsonReaderProvider diskReaderProvider = new JsonReaderProvider(m);

            configurator.ConfigureSourcePath(diskReaderProvider, Path.Combine(Environment.CurrentDirectory, "..\\..\\..\\Source Files\\Document1.json"));

            XmlWriterProvider xmlWriter = new XmlWriterProvider(m);

            configurator.ConfigureDestinationPath(xmlWriter, Path.Combine(Environment.CurrentDirectory, "..\\..\\..\\Target Files\\Document1.xml"));


            DoubleProvider <string, string> doubleProvider = new DoubleProvider <string, string>(diskReaderProvider, xmlWriter, m);

            doubleProvider.Process();

            Assert.IsTrue(File.Exists(Path.Combine(Environment.CurrentDirectory, "..\\..\\..\\Target Files\\Document1.xml")));
        }