示例#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")));
        }
示例#2
0
        public void DoubleProviderTestXmlToCloud()
        {
            Configurator configurator = new Configurator();

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

            XmlReaderProvider diskReaderProvider = new XmlReaderProvider(m);

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

            CloudWriterProvider writerProvider = new CloudWriterProvider(m);

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

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

            doubleProvider.Process();
        }