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