public void ReadMailSettingsWithEmptySettingsReturnsZeroResults()
        {
            var emptySettings = WebConfigSample.GetEmptySettings();
            var results       = WebConfigSettingsReader.ReadMailSettings(emptySettings.Document, ParametersGenerationStyle.Tokenize);

            emptySettings.ExpectedSettings.AssertHasSameItems(results);
        }
        public static WebConfigSample GetSimpleCompilationDebugSettings(ParametersGenerationStyle style)
        {
            var result = new WebConfigSample(Properties.Resources.SimpleSettings);

            result.AddExpectedApplicationSetting("Compilation.Debug", "/configuration/system.web/compilation/@debug", "true", style);
            return(result);
        }
        public void ReadMailSettingsWithSimpleSettingsReturnsAllWithValues()
        {
            var style          = ParametersGenerationStyle.Clone;
            var simpleSettings = WebConfigSample.GetSimpleMailSettings(style);
            var results        = WebConfigSettingsReader.ReadMailSettings(simpleSettings.Document, style);

            simpleSettings.ExpectedSettings.AssertHasSameItems(results);
        }
        public void ReadCompilationDebugSettingsWitEmpySettingsReturnsNull()
        {
            var style         = ParametersGenerationStyle.Tokenize;
            var emptySettings = WebConfigSample.GetEmptySettings();
            var result        = WebConfigSettingsReader.ReadCompilationDebugSettings(emptySettings.Document, style);

            Assert.IsNull(result);
        }
        public void ReadCompilationDebugSettingsWithSimpleSettingsReturnsTokenized()
        {
            var style          = ParametersGenerationStyle.Tokenize;
            var simpleSettings = WebConfigSample.GetSimpleCompilationDebugSettings(style);
            var results        = WebConfigSettingsReader.ReadCompilationDebugSettings(simpleSettings.Document, style);

            simpleSettings.ExpectedSettings.AssertHasSameItems(results);
        }
        public static WebConfigSample GetSimpleSessionStateSettings(ParametersGenerationStyle style)
        {
            var result = new WebConfigSample(Properties.Resources.SimpleSettings);

            result.AddExpectedApplicationSetting("SessionState.Mode", "/configuration/system.web/sessionState/@mode", "SQLServer", style);
            result.AddExpectedApplicationSetting("SessionState.ConnectionString", "/configuration/system.web/sessionState/@sqlConnectionString", "Data Source=myserver;Initial catalog=ASPState;User ID=aspsession;Password=passwordhere", style);

            return(result);
        }
        public static WebConfigSample GetSimpleMailSettings(ParametersGenerationStyle style)
        {
            var result = new WebConfigSample(Properties.Resources.SimpleSettings);

            result.AddExpectedApplicationSetting("Smtp.NetworkHost", "/configuration/system.net/mailSettings/smtp/network/@host", "localhost", style);
            result.AddExpectedApplicationSetting("Smtp.DeliveryMethod", "/configuration/system.net/mailSettings/smtp/@deliveryMethod", "Network", style);

            return(result);
        }
        public void ReadSessionStateSettingsWithLocationSimpleSettingsReturnsAllTokenized()
        {
            var style                  = ParametersGenerationStyle.Tokenize;
            var simpleSettings         = WebConfigSample.GetSimpleSessionStateSettings(style);
            var locationSimpleSettings = WebConfigSample.GetLocationSimpleSettings();
            var results                = WebConfigSettingsReader.ReadSessionStateSettings(locationSimpleSettings.Document, style);

            simpleSettings.ExpectedSettings.AssertHasSameItems(results);
        }
        public void ReadCompilationDebugSettingsWithLocationSimpleSettingsReturnsWithValues()
        {
            var style                  = ParametersGenerationStyle.Clone;
            var simpleSettings         = WebConfigSample.GetSimpleCompilationDebugSettings(style);
            var locationSimpleSettings = WebConfigSample.GetLocationSimpleSettings();
            var results                = WebConfigSettingsReader.ReadCompilationDebugSettings(locationSimpleSettings.Document, style);

            simpleSettings.ExpectedSettings.AssertHasSameItems(results);
        }
        public static WebConfigSample GetSimpleApplicationSettings(ParametersGenerationStyle style)
        {
            var result = new WebConfigSample(Properties.Resources.SimpleSettings);

            var appSettingsPathFormat = "/configuration/appSettings/add[@key='{0}']/@value";

            result.AddExpectedApplicationSetting("AppSettingsKey", string.Format(appSettingsPathFormat, "AppSettingsKey"), "0123", style);

            var applicationSettingsPathFormat = "/configuration/applicationSettings/TestApp.Properties.Settings/setting[@name='{0}']/value/text()";

            result.AddExpectedApplicationSetting("SomeString", string.Format(applicationSettingsPathFormat, "SomeString"), "String value is here.", style);
            result.AddExpectedApplicationSetting("SomeBoolean", string.Format(applicationSettingsPathFormat, "SomeBoolean"), "True", style);

            return(result);
        }
        public static WebConfigSample GetEmptySettings()
        {
            var result = new WebConfigSample(Properties.Resources.EmptySettings);

            return(result);
        }
Esempio n. 12
0
        public static WebConfigSample GetLocationSimpleSettings()
        {
            var result = new WebConfigSample(Properties.Resources.LocationSimpleSettings);

            return(result);
        }