コード例 #1
0
        public void CanLoadAndSaveInAssemblyUserScope()
        {
            const IsolatedStorageScope scope = IsolatedStorageScope.User | IsolatedStorageScope.Assembly;
            var source = new IsoStorageConfigurationSource(scope, _fileName);

            RunCreationTest(source);
        }
コード例 #2
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.Equal(sourceAsXml, newSourceAsXml);
            }
            finally
            {
                if (File.Exists(sourceFile))
                {
                    File.Delete(sourceFile);
                }
            }
        }
 public void CanLoadAndSaveInMachineStorForDomainScope()
 {
     const IsolatedStorageScope scope =
         IsolatedStorageScope.Machine | IsolatedStorageScope.Assembly | IsolatedStorageScope.Domain;
     var source =
         new IsoStorageConfigurationSource( scope, _fileName );
     RunCreationTest( source );
 }
コード例 #4
0
        public void CanLoadAndSaveInMachineStorForDomainScope()
        {
            const IsolatedStorageScope scope =
                IsolatedStorageScope.Machine | IsolatedStorageScope.Assembly | IsolatedStorageScope.Domain;
            var source =
                new IsoStorageConfigurationSource(scope, _fileName);

            RunCreationTest(source);
        }
 public void CanLoadAndSaveInAssemblyUserScope()
 {
     const IsolatedStorageScope scope = IsolatedStorageScope.User | IsolatedStorageScope.Assembly;
     var source = new IsoStorageConfigurationSource( scope, _fileName );
     RunCreationTest( source );
 }
        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.Equal( sourceAsXml, newSourceAsXml );
            }
            finally
            {
                if ( File.Exists( sourceFile ) )
                {
                    File.Delete( sourceFile );
                }
            }
        }