コード例 #1
0
        public void FileConfigurationAndSystemConfigurationDoNotShareImplementation()
        {
            BaseFileConfigurationSourceImplementation configSourceImpl1 = FileConfigurationSource.GetImplementation(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile);
            BaseFileConfigurationSourceImplementation configSourceImpl2 = SystemConfigurationSource.Implementation;

            Assert.IsFalse(object.ReferenceEquals(configSourceImpl1, configSourceImpl2));
        }
コード例 #2
0
        public void SharedConfigurationFilesCanHaveDifferentCasing()
        {
            string ConfigurationFilepath1 = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile.ToUpper();
            string ConfigurationFilepath2 = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile.ToLower();

            BaseFileConfigurationSourceImplementation configSourceImpl1 = FileConfigurationSource.GetImplementation(ConfigurationFilepath1);
            BaseFileConfigurationSourceImplementation configSourceImpl2 = FileConfigurationSource.GetImplementation(ConfigurationFilepath2);

            Assert.AreSame(configSourceImpl1, configSourceImpl2);
        }
コード例 #3
0
        public void DifferentConfigationFilesDoNotShareImplementation()
        {
            string fullConfigurationFilepath  = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
            string otherConfigurationFilepath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Other.config");

            File.Copy(fullConfigurationFilepath, otherConfigurationFilepath);
            try
            {
                BaseFileConfigurationSourceImplementation configSourceImpl1 = FileConfigurationSource.GetImplementation(fullConfigurationFilepath);
                BaseFileConfigurationSourceImplementation configSourceImpl2 = FileConfigurationSource.GetImplementation(otherConfigurationFilepath);

                Assert.IsFalse(object.ReferenceEquals(configSourceImpl1, configSourceImpl2));
            }
            finally
            {
                if (File.Exists(otherConfigurationFilepath))
                {
                    File.Delete(otherConfigurationFilepath);
                }
            }
        }