コード例 #1
0
 public void WriteNonXmlNodeValueTest()
 {
     using (ConfigurationContext configurationContext = CreateConfigurationContext(XmlString))
     {
         StorageProviderFactory factory = new StorageProviderFactory(configurationContext);
         IStorageProviderWriter storage = factory.Create(applConfig1) as IStorageProviderWriter;
         Assert.AreSame(storage.GetType(), typeof(XmlFileStorageProvider));
         storage.Write(new object());
     }
 }
コード例 #2
0
 public void StorageBadFileTest()
 {
     using (ConfigurationContext configurationContext = CreateConfigurationContext(XmlBadFileString))
     {
         StorageProviderFactory factory = new StorageProviderFactory(configurationContext);
         IStorageProviderWriter storage = factory.Create(applConfig1) as IStorageProviderWriter;
         Assert.AreSame(storage.GetType(), typeof(XmlFileStorageProvider));
         storage.Write(GetData());
     }
 }
コード例 #3
0
 public void BadFilePathStorageTest()
 {
     using (ConfigurationContext configurationContext = CreateConfigurationContext(XmlBadFilePathString))
     {
         StorageProviderFactory factory = new StorageProviderFactory(configurationContext);
         IStorageProviderWriter storage = factory.Create(applConfig1) as IStorageProviderWriter;
         Assert.AreSame(storage.GetType(), typeof(XmlFileStorageProvider));
         storage.Write(GetData());
         Assert.Fail("Should never get here since the file is not specified in configuration.");
     }
 }
コード例 #4
0
        public void StorageTestChangeEncryption()
        {
            SaveKeyAlgorithmPair(XmlStringWithEncryption);

            using (ConfigurationContext configurationContext = CreateConfigurationContext(XmlStringWithEncryption))
            {
                StorageProviderFactory factory = new StorageProviderFactory(configurationContext);
                IStorageProviderReader storage = factory.Create(applConfig1) as IStorageProviderReader;
                Assert.AreSame(storage.GetType(), typeof(XmlFileStorageProvider));
                ((IStorageProviderWriter)storage).Write(GetData());

                configurationContext.GetMetaConfiguration().ConfigurationSections[0].Encrypt = false;
                factory = new StorageProviderFactory(configurationContext);
                IStorageProviderWriter storageWriter = factory.Create(applConfig1) as IStorageProviderWriter;
                storageWriter.Write(GetData());

                XmlNode data = storageWriter.Read() as XmlNode;
                Assert.AreEqual(GetData().OuterXml, data.OuterXml);
            }
        }
コード例 #5
0
 public void Execute()
 {
     writer.Write(configurationData);
 }