コード例 #1
0
 public void CanLoadAndSaveInUserStorForDomainScope()
 {
     const IsolatedStorageScope scope =
             IsolatedStorageScope.User | IsolatedStorageScope.Assembly | IsolatedStorageScope.Domain;
     var source =
             new IsoStorageConfigurationSource( scope, _fileName );
     RunCreationTest( source );
 }
コード例 #2
0
 public void CanLoadAndSaveInMachineAssemblyScope()
 {
     const IsolatedStorageScope scope = IsolatedStorageScope.Machine | IsolatedStorageScope.Assembly;
     var source = new IsoStorageConfigurationSource( scope, _fileName );
     RunCreationTest( source );
 }
コード例 #3
0
        private void RunCreationTest( IsoStorageConfigurationSource source )
        {
            string sourceFile = string.Empty;
            try
            {
                source.Add( SectionGenerator.GetSingleSection() );
                source.Save();
                sourceFile = source.FullPath;
                // we should now have a file on the hdd with the settings we want.
                string sourceAsXml = XmlConfigurationSource.ToXml( source );

                // Now create a new instance so it can load the data.
                var newSource = new IsoStorageConfigurationSource( source.Scope, _fileName );
                string newSourceAsXml = XmlConfigurationSource.ToXml( newSource );
                Assert.AreEqual( sourceAsXml, newSourceAsXml );
            }
            finally
            {
                if ( File.Exists( sourceFile ) )
                {
                    File.Delete( sourceFile );
                }
            }
        }