コード例 #1
0
ファイル: ProviderTest.cs プロジェクト: andrejuha/Homework
        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
ファイル: ProviderTest.cs プロジェクト: andrejuha/Homework
        public void JsonWriterTest()
        {
            EmptyDirectory(Path.Combine(Environment.CurrentDirectory, "..\\..\\..\\Target Files"));

            Configurator configurator = new Configurator();

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

            JsonWriterProvider JsonWriter = new JsonWriterProvider(m);

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


            JsonWriter.ProcessData("<Employees><title ><ID>1</ID ><FirstName > David </FirstName > </title > <text></text ></Employees>");

            Assert.IsTrue(File.Exists(Path.Combine(Environment.CurrentDirectory, "..\\..\\..\\Target Files\\Document1.json")));
        }
コード例 #3
0
ファイル: ProviderTest.cs プロジェクト: andrejuha/Homework
        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();
        }
コード例 #4
0
ファイル: ProviderTest.cs プロジェクト: andrejuha/Homework
        public void DoubleProviderTestXmlToJson()
        {
            EmptyDirectory(Path.Combine(Environment.CurrentDirectory, "..\\..\\..\\Target Files"));

            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"));

            JsonWriterProvider jsonWriter = new JsonWriterProvider(m);

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


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

            doubleProvider.Process();

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