From dfc45053fb157fa27880b39e4cc80f1ab898f18a Mon Sep 17 00:00:00 2001 From: sbohlen Date: Tue, 17 Aug 2010 18:41:44 +0000 Subject: [PATCH] misc updates to cleanup VS2010 projects and tests --- .../Config/ConnectionStringsVariableSource.cs | 194 +++--- ...sactionalMessageListenerContainerTests.xml | 2 +- .../Spring.Web.Tests.2010.csproj | 1 + .../Web/Support/ResultTests.cs | 618 +++++++++--------- 4 files changed, 408 insertions(+), 407 deletions(-) diff --git a/src/Spring/Spring.Core/Objects/Factory/Config/ConnectionStringsVariableSource.cs b/src/Spring/Spring.Core/Objects/Factory/Config/ConnectionStringsVariableSource.cs index 64c8e099..cff264cb 100644 --- a/src/Spring/Spring.Core/Objects/Factory/Config/ConnectionStringsVariableSource.cs +++ b/src/Spring/Spring.Core/Objects/Factory/Config/ConnectionStringsVariableSource.cs @@ -1,62 +1,62 @@ -#if NET_2_0 -#region License - -/* - * Copyright © 2002-2007 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#endregion - -using System; +#if NET_2_0 +#region License + +/* + * Copyright © 2002-2007 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#endregion + +using System; using System.Collections; -using System.Collections.Specialized; -using System.Configuration; -using Spring.Util; - -namespace Spring.Objects.Factory.Config -{ - /// - /// Implementation of that - /// resolves variable name connection strings defined in - /// the standard .NET configuration file. - /// - /// - ///

- /// When the <connectionStrings> configuration section is processed by this class, - /// two variables are defined for each connection string: one for connection string and - /// the second one for the provider name.

- ///

- /// Variable names are generated by appending '.connectionString' and '.providerName' - /// literals to the value of the name attribute of the connection string element. - /// For example:

- ///
-    /// 
-    ///    
-    /// 
-    /// 
- ///

- /// will result in two variables being created: myConn.connectionString and myConn.providerName. - /// You can reference these variables within your object definitions, just like any other variable.

- ///
- /// Aleksandar Seovic - [Serializable] - public class ConnectionStringsVariableSource : IVariableSource - { - private Hashtable variables; - - +using System.Collections.Specialized; +using System.Configuration; +using Spring.Util; + +namespace Spring.Objects.Factory.Config +{ + /// + /// Implementation of that + /// resolves variable name connection strings defined in + /// the standard .NET configuration file. + /// + /// + ///

+ /// When the <connectionStrings> configuration section is processed by this class, + /// two variables are defined for each connection string: one for connection string and + /// the second one for the provider name.

+ ///

+ /// Variable names are generated by appending '.connectionString' and '.providerName' + /// literals to the value of the name attribute of the connection string element. + /// For example:

+ ///
+    /// 
+    ///    
+    /// 
+    /// 
+ ///

+ /// will result in two variables being created: myConn.connectionString and myConn.providerName. + /// You can reference these variables within your object definitions, just like any other variable.

+ ///
+ /// Aleksandar Seovic + [Serializable] + public class ConnectionStringsVariableSource : IVariableSource + { + private Hashtable variables; + + /// /// Before requesting a variable resolution, a client should /// ask, whether the source can resolve a particular variable name. @@ -68,45 +68,45 @@ namespace Spring.Objects.Factory.Config if (variables == null) { InitVariables(); - } - return variables.Contains(name); + } + return variables.Contains(name); } - /// - /// Resolves variable value for the specified variable name. - /// - /// - /// The name of the variable to resolve. - /// - /// - /// The variable value if able to resolve, null otherwise. - /// - public string ResolveVariable(string name) - { - if (variables == null) - { - InitVariables(); - } - return (string) variables[name]; - } - - /// - /// Initializes properties based on the specified - /// property file locations. - /// - private void InitVariables() - { - variables = CollectionsUtil.CreateCaseInsensitiveHashtable(); - ConnectionStringSettingsCollection settings = ConfigurationManager.ConnectionStrings; - foreach (ConnectionStringSettings setting in settings) - { - string providerName = setting.ProviderName; - - variables.Add(setting.Name + ".connectionString", setting.ConnectionString); - variables.Add(setting.Name + ".providerName", - StringUtils.HasText(providerName) ? providerName : "System.Data.SqlClient"); - } - } - } -} + /// + /// Resolves variable value for the specified variable name. + /// + /// + /// The name of the variable to resolve. + /// + /// + /// The variable value if able to resolve, null otherwise. + /// + public string ResolveVariable(string name) + { + if (variables == null) + { + InitVariables(); + } + return (string) variables[name]; + } + + /// + /// Initializes properties based on the specified + /// property file locations. + /// + private void InitVariables() + { + variables = CollectionsUtil.CreateCaseInsensitiveHashtable(); + ConnectionStringSettingsCollection settings = ConfigurationManager.ConnectionStrings; + foreach (ConnectionStringSettings setting in settings) + { + string providerName = setting.ProviderName; + + variables.Add(setting.Name + ".connectionString", setting.ConnectionString); + variables.Add(setting.Name + ".providerName", + StringUtils.HasText(providerName) ? providerName : "System.Data.SqlClient"); + } + } + } +} #endif \ No newline at end of file diff --git a/test/Spring/Spring.Messaging.Tests/Messaging/Listener/NonTransactionalMessageListenerContainerTests.xml b/test/Spring/Spring.Messaging.Tests/Messaging/Listener/NonTransactionalMessageListenerContainerTests.xml index 1601f5b5..852306c8 100644 --- a/test/Spring/Spring.Messaging.Tests/Messaging/Listener/NonTransactionalMessageListenerContainerTests.xml +++ b/test/Spring/Spring.Messaging.Tests/Messaging/Listener/NonTransactionalMessageListenerContainerTests.xml @@ -34,7 +34,7 @@ - + diff --git a/test/Spring/Spring.Web.Tests/Spring.Web.Tests.2010.csproj b/test/Spring/Spring.Web.Tests/Spring.Web.Tests.2010.csproj index afefc41e..3b043738 100644 --- a/test/Spring/Spring.Web.Tests/Spring.Web.Tests.2010.csproj +++ b/test/Spring/Spring.Web.Tests/Spring.Web.Tests.2010.csproj @@ -134,6 +134,7 @@ ASPXCodeBehind + diff --git a/test/Spring/Spring.Web.Tests/Web/Support/ResultTests.cs b/test/Spring/Spring.Web.Tests/Web/Support/ResultTests.cs index c66a6b6a..764ed6ac 100644 --- a/test/Spring/Spring.Web.Tests/Web/Support/ResultTests.cs +++ b/test/Spring/Spring.Web.Tests/Web/Support/ResultTests.cs @@ -29,138 +29,138 @@ using Spring.Util; namespace Spring.Web.Support { - /// - /// Unit tests for the Result class. - /// - /// Rick Evans - [TestFixture] - public sealed class ResultTests - { - private const string ExpectedTargetPageName = "Foo.aspx"; + /// + /// Unit tests for the Result class. + /// + /// Rick Evans + [TestFixture] + public sealed class ResultTests + { + private const string ExpectedTargetPageName = "Foo.aspx"; - [Test] - public void DoesItDefaultToTheDefaultResultMode() - { - Result result = new Result(); - Assert.AreEqual(Result.DefaultResultMode, result.Mode, "Not defaulting to the default ResultMode."); - } + [Test] + public void DoesItDefaultToTheDefaultResultMode() + { + Result result = new Result(); + Assert.AreEqual(Result.DefaultResultMode, result.Mode, "Not defaulting to the default ResultMode."); + } - [Test] - public void DefaultsToTransferMode() - { - Assert.AreEqual(ResultMode.Transfer, Result.DefaultResultMode, - "Hey! Be sure to change the documentation since you've " + - "obviously gone and changed the default transfer mode."); - } + [Test] + public void DefaultsToTransferMode() + { + Assert.AreEqual(ResultMode.Transfer, Result.DefaultResultMode, + "Hey! Be sure to change the documentation since you've " + + "obviously gone and changed the default transfer mode."); + } - [Test] - [ExpectedException(typeof (ArgumentNullException))] - public void InstantiationBailsWithNullResultString() - { - new Result(null); - } + [Test] + [ExpectedException(typeof (ArgumentNullException))] + public void InstantiationBailsWithNullResultString() + { + new Result(null); + } - [Test] - [ExpectedException(typeof (ArgumentNullException))] - public void InstantiationBailsWithEmptyResultString() - { - new Result(string.Empty); - } + [Test] + [ExpectedException(typeof (ArgumentNullException))] + public void InstantiationBailsWithEmptyResultString() + { + new Result(string.Empty); + } - [Test] - [ExpectedException(typeof (ArgumentNullException))] - public void InstantiationBailsWithAllWhitespaceResultString() - { - new Result(" \n\t "); - } + [Test] + [ExpectedException(typeof (ArgumentNullException))] + public void InstantiationBailsWithAllWhitespaceResultString() + { + new Result(" \n\t "); + } - [Test] - public void WithNoResultModeAndNoParameters() - { - Result result = new Result(ExpectedTargetPageName); - Assert.AreEqual(Result.DefaultResultMode, result.Mode, "Not defaulting to the default ResultMode."); - Assert.IsNull(result.Parameters, - "No parameters were passed but the Parameters property appears to be set to a non-null value anyway."); - Assert.AreEqual(ExpectedTargetPageName, result.TargetPage, - "The TargetPage property is not being correctly extracted " + - "from the result string passed into the ctor."); - } + [Test] + public void WithNoResultModeAndNoParameters() + { + Result result = new Result(ExpectedTargetPageName); + Assert.AreEqual(Result.DefaultResultMode, result.Mode, "Not defaulting to the default ResultMode."); + Assert.IsNull(result.Parameters, + "No parameters were passed but the Parameters property appears to be set to a non-null value anyway."); + Assert.AreEqual(ExpectedTargetPageName, result.TargetPage, + "The TargetPage property is not being correctly extracted " + + "from the result string passed into the ctor."); + } - [Test] - public void WithWhitespacePageAndNoResultModeAndNoParameters() - { - Result result = new Result(" " + ExpectedTargetPageName + "\n"); - Assert.AreEqual(Result.DefaultResultMode, result.Mode, "Not defaulting to the default ResultMode."); - Assert.IsNull(result.Parameters, - "No parameters were passed but the Parameters property appears to be set to a non-null value anyway."); - Assert.AreEqual(ExpectedTargetPageName, result.TargetPage, - "The TargetPage property is not being correctly extracted " + - "from the result string passed into the ctor."); - } + [Test] + public void WithWhitespacePageAndNoResultModeAndNoParameters() + { + Result result = new Result(" " + ExpectedTargetPageName + "\n"); + Assert.AreEqual(Result.DefaultResultMode, result.Mode, "Not defaulting to the default ResultMode."); + Assert.IsNull(result.Parameters, + "No parameters were passed but the Parameters property appears to be set to a non-null value anyway."); + Assert.AreEqual(ExpectedTargetPageName, result.TargetPage, + "The TargetPage property is not being correctly extracted " + + "from the result string passed into the ctor."); + } - [Test] - public void WithTransferResultModeButNoParameters() - { - Result result = new Result("transfer:" + ExpectedTargetPageName); - Assert.AreEqual(ResultMode.Transfer, result.Mode, "Not extracting the correct ResultMode " + - "from the result string passed into the ctor."); - Assert.AreEqual(true, result.PreserveForm, "ResultMode.Transfer must result in PreserveForm being 'true'"); - Assert.IsNull(result.Parameters, - "No parameters were passed but the Parameters property appears to be set to a non-null value anyway."); - Assert.AreEqual(ExpectedTargetPageName, result.TargetPage, - "The TargetPage property is not being correctly extracted " + - "from the result string passed into the ctor."); - } + [Test] + public void WithTransferResultModeButNoParameters() + { + Result result = new Result("transfer:" + ExpectedTargetPageName); + Assert.AreEqual(ResultMode.Transfer, result.Mode, "Not extracting the correct ResultMode " + + "from the result string passed into the ctor."); + Assert.AreEqual(true, result.PreserveForm, "ResultMode.Transfer must result in PreserveForm being 'true'"); + Assert.IsNull(result.Parameters, + "No parameters were passed but the Parameters property appears to be set to a non-null value anyway."); + Assert.AreEqual(ExpectedTargetPageName, result.TargetPage, + "The TargetPage property is not being correctly extracted " + + "from the result string passed into the ctor."); + } - [Test] - public void WithTransferNoPreserveResultMode() - { - Result result = new Result( "transfernopreserve:" + ExpectedTargetPageName ); - Assert.AreEqual( ResultMode.TransferNoPreserve,result.Mode,"Not extracting the correct ResultMode " + - "from the result string passed into the ctor." ); - Assert.AreEqual( false,result.PreserveForm,"ResultMode.TransferNoPreserver must result in PreserveForm being 'false'" ); - } + [Test] + public void WithTransferNoPreserveResultMode() + { + Result result = new Result( "transfernopreserve:" + ExpectedTargetPageName ); + Assert.AreEqual( ResultMode.TransferNoPreserve,result.Mode,"Not extracting the correct ResultMode " + + "from the result string passed into the ctor." ); + Assert.AreEqual( false,result.PreserveForm,"ResultMode.TransferNoPreserver must result in PreserveForm being 'false'" ); + } - [Test] - public void WithWhitespacedRedirectResultMode() - { - Result result = new Result(" redirect:" + ExpectedTargetPageName); - Assert.AreEqual(ResultMode.Redirect, result.Mode, "Not extracting the correct ResultMode " + - "from the result string passed into the ctor."); - Assert.IsNull(result.Parameters, - "No parameters were passed but the Parameters property appears to be set to a non-null value anyway."); - Assert.AreEqual(ExpectedTargetPageName, result.TargetPage, - "The TargetPage property is not being correctly extracted " + - "from the result string passed into the ctor."); - } + [Test] + public void WithWhitespacedRedirectResultMode() + { + Result result = new Result(" redirect:" + ExpectedTargetPageName); + Assert.AreEqual(ResultMode.Redirect, result.Mode, "Not extracting the correct ResultMode " + + "from the result string passed into the ctor."); + Assert.IsNull(result.Parameters, + "No parameters were passed but the Parameters property appears to be set to a non-null value anyway."); + Assert.AreEqual(ExpectedTargetPageName, result.TargetPage, + "The TargetPage property is not being correctly extracted " + + "from the result string passed into the ctor."); + } - [Test] - public void WithRedirectResultMode() - { - Result result = new Result("redirect:" + ExpectedTargetPageName); - Assert.AreEqual(ResultMode.Redirect, result.Mode, "Not extracting the correct ResultMode " + - "from the result string passed into the ctor."); - Assert.IsTrue(result.EndResponse); - Assert.IsNull(result.Parameters, - "No parameters were passed but the Parameters property appears to be set to a non-null value anyway."); - Assert.AreEqual(ExpectedTargetPageName, result.TargetPage, - "The TargetPage property is not being correctly extracted " + - "from the result string passed into the ctor."); - } + [Test] + public void WithRedirectResultMode() + { + Result result = new Result("redirect:" + ExpectedTargetPageName); + Assert.AreEqual(ResultMode.Redirect, result.Mode, "Not extracting the correct ResultMode " + + "from the result string passed into the ctor."); + Assert.IsTrue(result.EndResponse); + Assert.IsNull(result.Parameters, + "No parameters were passed but the Parameters property appears to be set to a non-null value anyway."); + Assert.AreEqual(ExpectedTargetPageName, result.TargetPage, + "The TargetPage property is not being correctly extracted " + + "from the result string passed into the ctor."); + } - [Test] - public void WithRedirectNoAbortResultMode() - { - Result result = new Result("redirectnoabort:" + ExpectedTargetPageName); - Assert.AreEqual(ResultMode.RedirectNoAbort, result.Mode, "Not extracting the correct ResultMode " + - "from the result string passed into the ctor."); - Assert.IsFalse(result.EndResponse); - Assert.IsNull(result.Parameters, - "No parameters were passed but the Parameters property appears to be set to a non-null value anyway."); - Assert.AreEqual(ExpectedTargetPageName, result.TargetPage, - "The TargetPage property is not being correctly extracted " + - "from the result string passed into the ctor."); - } + [Test] + public void WithRedirectNoAbortResultMode() + { + Result result = new Result("redirectnoabort:" + ExpectedTargetPageName); + Assert.AreEqual(ResultMode.RedirectNoAbort, result.Mode, "Not extracting the correct ResultMode " + + "from the result string passed into the ctor."); + Assert.IsFalse(result.EndResponse); + Assert.IsNull(result.Parameters, + "No parameters were passed but the Parameters property appears to be set to a non-null value anyway."); + Assert.AreEqual(ExpectedTargetPageName, result.TargetPage, + "The TargetPage property is not being correctly extracted " + + "from the result string passed into the ctor."); + } [Test] [ExpectedException(typeof(ArgumentOutOfRangeException))] @@ -170,96 +170,96 @@ namespace Spring.Web.Support new Result("redirct:" + ExpectedTargetPageName); } - [Test] - public void WithResultModeAndEmptyParameterDelimiterOnly() - { - Result result = new Result("transfer:" + ExpectedTargetPageName + "?"); - Assert.AreEqual(ResultMode.Transfer, result.Mode, "Not extracting the correct ResultMode " + - "from the result string passed into the ctor."); - Assert.IsNull(result.Parameters, - "No parameters were passed (just the parameter delimiter) but the " + - "Parameters property appears to be set to a non-null value anyway."); - Assert.AreEqual(ExpectedTargetPageName, result.TargetPage, - "The TargetPage property is not being correctly extracted " + - "from the result string passed into the ctor."); - } + [Test] + public void WithResultModeAndEmptyParameterDelimiterOnly() + { + Result result = new Result("transfer:" + ExpectedTargetPageName + "?"); + Assert.AreEqual(ResultMode.Transfer, result.Mode, "Not extracting the correct ResultMode " + + "from the result string passed into the ctor."); + Assert.IsNull(result.Parameters, + "No parameters were passed (just the parameter delimiter) but the " + + "Parameters property appears to be set to a non-null value anyway."); + Assert.AreEqual(ExpectedTargetPageName, result.TargetPage, + "The TargetPage property is not being correctly extracted " + + "from the result string passed into the ctor."); + } - [Test] - public void WithResultModeAndWhitespaceParameterDelimiterOnly() - { - Result result = new Result("redirect:" + ExpectedTargetPageName + "? "); - Assert.AreEqual(ResultMode.Redirect, result.Mode, "Not extracting the correct ResultMode " + - "from the result string passed into the ctor."); - Assert.IsNull(result.Parameters, - "No parameters were passed (just the parameter delimiter) but the " + - "Parameters property appears to be set to a non-null value anyway."); - Assert.AreEqual(ExpectedTargetPageName, result.TargetPage, - "The TargetPage property is not being correctly extracted " + - "from the result string passed into the ctor."); - } + [Test] + public void WithResultModeAndWhitespaceParameterDelimiterOnly() + { + Result result = new Result("redirect:" + ExpectedTargetPageName + "? "); + Assert.AreEqual(ResultMode.Redirect, result.Mode, "Not extracting the correct ResultMode " + + "from the result string passed into the ctor."); + Assert.IsNull(result.Parameters, + "No parameters were passed (just the parameter delimiter) but the " + + "Parameters property appears to be set to a non-null value anyway."); + Assert.AreEqual(ExpectedTargetPageName, result.TargetPage, + "The TargetPage property is not being correctly extracted " + + "from the result string passed into the ctor."); + } - [Test] - public void WithNoResultModeAndWhitespaceParameterDelimiterOnly() - { - Result result = new Result(ExpectedTargetPageName + "? "); - Assert.AreEqual(Result.DefaultResultMode, result.Mode, "Not defaulting to the default ResultMode."); - Assert.IsNull(result.Parameters, - "No parameters were passed (just the parameter delimiter) but the " + - "Parameters property appears to be set to a non-null value anyway."); - Assert.AreEqual(ExpectedTargetPageName, result.TargetPage, - "The TargetPage property is not being correctly extracted " + - "from the result string passed into the ctor."); - } + [Test] + public void WithNoResultModeAndWhitespaceParameterDelimiterOnly() + { + Result result = new Result(ExpectedTargetPageName + "? "); + Assert.AreEqual(Result.DefaultResultMode, result.Mode, "Not defaulting to the default ResultMode."); + Assert.IsNull(result.Parameters, + "No parameters were passed (just the parameter delimiter) but the " + + "Parameters property appears to be set to a non-null value anyway."); + Assert.AreEqual(ExpectedTargetPageName, result.TargetPage, + "The TargetPage property is not being correctly extracted " + + "from the result string passed into the ctor."); + } - [Test] - public void WithNoResultModeAndOneParameter() - { - const string key = "id"; - const string value = "Nina Persson"; - Result result = new Result(ExpectedTargetPageName + "?" + key + "=" + value); - Assert.AreEqual(Result.DefaultResultMode, result.Mode, "Not defaulting to the default ResultMode."); - Assert.IsNotNull(result.Parameters, - "Parameters were passed but the Parameters property appears to be null (incorrectly)."); - Assert.AreEqual(1, result.Parameters.Count, - "Wrong number of query parameters parsed (only supplied one key-value pair)."); - Assert.IsTrue(result.Parameters.Contains(key), "The 'id' parameter is not being correctly extracted " + - "from the result string passed into the ctor."); - Assert.AreEqual(value, result.Parameters[key]); - Assert.AreEqual(ExpectedTargetPageName, result.TargetPage, - "The TargetPage property is not being correctly extracted " + - "from the result string passed into the ctor."); - } + [Test] + public void WithNoResultModeAndOneParameter() + { + const string key = "id"; + const string value = "Nina Persson"; + Result result = new Result(ExpectedTargetPageName + "?" + key + "=" + value); + Assert.AreEqual(Result.DefaultResultMode, result.Mode, "Not defaulting to the default ResultMode."); + Assert.IsNotNull(result.Parameters, + "Parameters were passed but the Parameters property appears to be null (incorrectly)."); + Assert.AreEqual(1, result.Parameters.Count, + "Wrong number of query parameters parsed (only supplied one key-value pair)."); + Assert.IsTrue(result.Parameters.Contains(key), "The 'id' parameter is not being correctly extracted " + + "from the result string passed into the ctor."); + Assert.AreEqual(value, result.Parameters[key]); + Assert.AreEqual(ExpectedTargetPageName, result.TargetPage, + "The TargetPage property is not being correctly extracted " + + "from the result string passed into the ctor."); + } - [Test] - public void WithTransferResultModeAndOneParameter() - { - const string key = "id"; - const string value = "Nina Persson"; - Result result = new Result("transfer:" + ExpectedTargetPageName + "?" + key + "=" + value); - Assert.AreEqual(ResultMode.Transfer, result.Mode, "Not extracting the correct ResultMode " + - "from the result string passed into the ctor."); - Assert.IsNotNull(result.Parameters, - "Parameters were passed but the Parameters property appears to be null (incorrectly)."); - Assert.AreEqual(1, result.Parameters.Count, - "Wrong number of query parameters parsed (only supplied one key-value pair)."); - Assert.IsTrue(result.Parameters.Contains(key), "The 'id' parameter is not being correctly extracted " + - "from the result string passed into the ctor."); - Assert.AreEqual(value, result.Parameters[key]); - Assert.AreEqual(ExpectedTargetPageName, result.TargetPage, - "The TargetPage property is not being correctly extracted " + - "from the result string passed into the ctor."); - } + [Test] + public void WithTransferResultModeAndOneParameter() + { + const string key = "id"; + const string value = "Nina Persson"; + Result result = new Result("transfer:" + ExpectedTargetPageName + "?" + key + "=" + value); + Assert.AreEqual(ResultMode.Transfer, result.Mode, "Not extracting the correct ResultMode " + + "from the result string passed into the ctor."); + Assert.IsNotNull(result.Parameters, + "Parameters were passed but the Parameters property appears to be null (incorrectly)."); + Assert.AreEqual(1, result.Parameters.Count, + "Wrong number of query parameters parsed (only supplied one key-value pair)."); + Assert.IsTrue(result.Parameters.Contains(key), "The 'id' parameter is not being correctly extracted " + + "from the result string passed into the ctor."); + Assert.AreEqual(value, result.Parameters[key]); + Assert.AreEqual(ExpectedTargetPageName, result.TargetPage, + "The TargetPage property is not being correctly extracted " + + "from the result string passed into the ctor."); + } - [Test] - [Ignore("How does one escape ampersands then?")] - public void ParametersHavingEmbeddedCharactersThatHaveToBeEscaped() - { - const string key = "id"; - const string value = "Nina Persson & The Cardigans"; // notice the use of the embedded '&'... - Result result = new Result(ExpectedTargetPageName + "?" + key + "=" + value); - Assert.AreEqual(Result.DefaultResultMode, result.Mode, "Not defaulting to the default ResultMode."); - Assert.IsNotNull(result.Parameters, - "Parameters were passed but the Parameters property appears to be null (incorrectly)."); + [Test] + [Ignore("How does one escape ampersands then?")] + public void ParametersHavingEmbeddedCharactersThatHaveToBeEscaped() + { + const string key = "id"; + const string value = "Nina Persson & The Cardigans"; // notice the use of the embedded '&'... + Result result = new Result(ExpectedTargetPageName + "?" + key + "=" + value); + Assert.AreEqual(Result.DefaultResultMode, result.Mode, "Not defaulting to the default ResultMode."); + Assert.IsNotNull(result.Parameters, + "Parameters were passed but the Parameters property appears to be null (incorrectly)."); // Assert.AreEqual(1, result.Parameters.Count, // "Wrong number of query parameters parsed (only supplied one key-value pair)."); // Assert.IsTrue(result.Parameters.Contains(key), "The 'id' parameter is not being correctly extracted " + @@ -268,114 +268,114 @@ namespace Spring.Web.Support // Assert.AreEqual(ExpectedTargetPageName, result.TargetPage, // "The TargetPage property is not being correctly extracted " + // "from the result string passed into the ctor."); - } + } - [Test] - public void WithTransferResultModeAndTwoParametersSplitUsingAmpersand() - { - const string pKey1 = "id"; - const string pValue1 = "Nina Persson"; - const string pKey2 = "verdict"; - const string pValue2 = "schwing"; - Result result = - new Result(ExpectedTargetPageName + "?" + pKey1 + "=" + pValue1 + "&" + pKey2 + "=" + pValue2); - Assert.AreEqual(ResultMode.Transfer, result.Mode, "Not extracting the correct ResultMode " + - "from the result string passed into the ctor."); - Assert.IsNotNull(result.Parameters, - "Parameters were passed but the Parameters property appears to be null (incorrectly)."); - Assert.AreEqual(2, result.Parameters.Count, - "Wrong number of query parameters parsed (supplied two key-value pairs)."); - Assert.IsTrue(result.Parameters.Contains(pKey1), "The 'id' parameter is not being correctly extracted " + - "from the result string passed into the ctor."); - Assert.AreEqual(pValue1, result.Parameters[pKey1]); - Assert.IsTrue(result.Parameters.Contains(pKey2), - "The 'verdict' parameter is not being correctly extracted " + - "from the result string passed into the ctor."); - Assert.AreEqual(pValue2, result.Parameters[pKey2]); - Assert.AreEqual(ExpectedTargetPageName, result.TargetPage, - "The TargetPage property is not being correctly extracted " + - "from the result string passed into the ctor."); - } + [Test] + public void WithTransferResultModeAndTwoParametersSplitUsingAmpersand() + { + const string pKey1 = "id"; + const string pValue1 = "Nina Persson"; + const string pKey2 = "verdict"; + const string pValue2 = "schwing"; + Result result = + new Result(ExpectedTargetPageName + "?" + pKey1 + "=" + pValue1 + "&" + pKey2 + "=" + pValue2); + Assert.AreEqual(ResultMode.Transfer, result.Mode, "Not extracting the correct ResultMode " + + "from the result string passed into the ctor."); + Assert.IsNotNull(result.Parameters, + "Parameters were passed but the Parameters property appears to be null (incorrectly)."); + Assert.AreEqual(2, result.Parameters.Count, + "Wrong number of query parameters parsed (supplied two key-value pairs)."); + Assert.IsTrue(result.Parameters.Contains(pKey1), "The 'id' parameter is not being correctly extracted " + + "from the result string passed into the ctor."); + Assert.AreEqual(pValue1, result.Parameters[pKey1]); + Assert.IsTrue(result.Parameters.Contains(pKey2), + "The 'verdict' parameter is not being correctly extracted " + + "from the result string passed into the ctor."); + Assert.AreEqual(pValue2, result.Parameters[pKey2]); + Assert.AreEqual(ExpectedTargetPageName, result.TargetPage, + "The TargetPage property is not being correctly extracted " + + "from the result string passed into the ctor."); + } - [Test] - public void WithWhitespacedPageAndTransferResultModeAndTwoParametersUsingAmpersands() - { - const string pKey1 = "id"; - const string pValue1 = "Nina Persson"; - const string pKey2 = "verdict"; - const string pValue2 = "schwing"; - Result result = - new Result("\n" + ExpectedTargetPageName + " ?" + pKey1 + "=" + pValue1 + "&" + pKey2 + "=" + pValue2); - Assert.AreEqual(ResultMode.Transfer, result.Mode, "Not extracting the correct ResultMode " + - "from the result string passed into the ctor."); - Assert.IsNotNull(result.Parameters, - "Parameters were passed but the Parameters property appears to be null (incorrectly)."); - Assert.AreEqual(2, result.Parameters.Count, - "Wrong number of query parameters parsed (supplied two key-value pairs)."); - Assert.IsTrue(result.Parameters.Contains(pKey1), "The 'id' parameter is not being correctly extracted " + - "from the result string passed into the ctor."); - Assert.AreEqual(pValue1, result.Parameters[pKey1]); - Assert.IsTrue(result.Parameters.Contains(pKey2), - "The 'verdict' parameter is not being correctly extracted " + - "from the result string passed into the ctor."); - Assert.AreEqual(pValue2, result.Parameters[pKey2]); - Assert.AreEqual(ExpectedTargetPageName, result.TargetPage, - "The TargetPage property is not being correctly extracted " + - "from the result string passed into the ctor."); - } + [Test] + public void WithWhitespacedPageAndTransferResultModeAndTwoParametersUsingAmpersands() + { + const string pKey1 = "id"; + const string pValue1 = "Nina Persson"; + const string pKey2 = "verdict"; + const string pValue2 = "schwing"; + Result result = + new Result("\n" + ExpectedTargetPageName + " ?" + pKey1 + "=" + pValue1 + "&" + pKey2 + "=" + pValue2); + Assert.AreEqual(ResultMode.Transfer, result.Mode, "Not extracting the correct ResultMode " + + "from the result string passed into the ctor."); + Assert.IsNotNull(result.Parameters, + "Parameters were passed but the Parameters property appears to be null (incorrectly)."); + Assert.AreEqual(2, result.Parameters.Count, + "Wrong number of query parameters parsed (supplied two key-value pairs)."); + Assert.IsTrue(result.Parameters.Contains(pKey1), "The 'id' parameter is not being correctly extracted " + + "from the result string passed into the ctor."); + Assert.AreEqual(pValue1, result.Parameters[pKey1]); + Assert.IsTrue(result.Parameters.Contains(pKey2), + "The 'verdict' parameter is not being correctly extracted " + + "from the result string passed into the ctor."); + Assert.AreEqual(pValue2, result.Parameters[pKey2]); + Assert.AreEqual(ExpectedTargetPageName, result.TargetPage, + "The TargetPage property is not being correctly extracted " + + "from the result string passed into the ctor."); + } - [Test] - public void WithWhitespacedPageAndTransferResultModeAndTwoParametersUsingCommas() - { - const string pKey1 = "id"; - const string pValue1 = "Nina Persson"; - const string pKey2 = "verdict"; - const string pValue2 = "schwing"; - Result result = - new Result("\n" + ExpectedTargetPageName + " ?" + pKey1 + "=" + pValue1 + "," + pKey2 + "=" + pValue2); - Assert.AreEqual(ResultMode.Transfer, result.Mode, "Not extracting the correct ResultMode " + - "from the result string passed into the ctor."); - Assert.IsNotNull(result.Parameters, - "Parameters were passed but the Parameters property appears to be null (incorrectly)."); - Assert.AreEqual(2, result.Parameters.Count, - "Wrong number of query parameters parsed (supplied two key-value pairs)."); - Assert.IsTrue(result.Parameters.Contains(pKey1), "The 'id' parameter is not being correctly extracted " + - "from the result string passed into the ctor."); - Assert.AreEqual(pValue1, result.Parameters[pKey1]); - Assert.IsTrue(result.Parameters.Contains(pKey2), - "The 'verdict' parameter is not being correctly extracted " + - "from the result string passed into the ctor."); - Assert.AreEqual(pValue2, result.Parameters[pKey2]); - Assert.AreEqual(ExpectedTargetPageName, result.TargetPage, - "The TargetPage property is not being correctly extracted " + - "from the result string passed into the ctor."); - } + [Test] + public void WithWhitespacedPageAndTransferResultModeAndTwoParametersUsingCommas() + { + const string pKey1 = "id"; + const string pValue1 = "Nina Persson"; + const string pKey2 = "verdict"; + const string pValue2 = "schwing"; + Result result = + new Result("\n" + ExpectedTargetPageName + " ?" + pKey1 + "=" + pValue1 + "," + pKey2 + "=" + pValue2); + Assert.AreEqual(ResultMode.Transfer, result.Mode, "Not extracting the correct ResultMode " + + "from the result string passed into the ctor."); + Assert.IsNotNull(result.Parameters, + "Parameters were passed but the Parameters property appears to be null (incorrectly)."); + Assert.AreEqual(2, result.Parameters.Count, + "Wrong number of query parameters parsed (supplied two key-value pairs)."); + Assert.IsTrue(result.Parameters.Contains(pKey1), "The 'id' parameter is not being correctly extracted " + + "from the result string passed into the ctor."); + Assert.AreEqual(pValue1, result.Parameters[pKey1]); + Assert.IsTrue(result.Parameters.Contains(pKey2), + "The 'verdict' parameter is not being correctly extracted " + + "from the result string passed into the ctor."); + Assert.AreEqual(pValue2, result.Parameters[pKey2]); + Assert.AreEqual(ExpectedTargetPageName, result.TargetPage, + "The TargetPage property is not being correctly extracted " + + "from the result string passed into the ctor."); + } - [Test] - public void TargetPageMayBeRuntimeExpression() - { - Result result = new Result("%{['var1']}"); - string resultUri = result.GetRedirectUri( MakeDictionary("var1", "val1") ); - Assert.AreEqual( "val1", resultUri ); - } + [Test] + public void TargetPageMayBeRuntimeExpression() + { + Result result = new Result("%{['var1']}"); + string resultUri = result.GetRedirectUri( MakeDictionary("var1", "val1") ); + Assert.AreEqual( "val1", resultUri ); + } - [Test] - public void ParameterKeysAndValuesMayBeRuntimeExpression() - { - Result result = new Result("redirect:%{['var1']}?%{['var2']}=%{['var3']}"); - string resultUri = result.GetRedirectUri( MakeDictionary("var1", "val1", "var2", "val2", "var3", "val3") ); - Assert.AreEqual( "val1?val2=val3", resultUri ); - } + [Test] + public void ParameterKeysAndValuesMayBeRuntimeExpression() + { + Result result = new Result("redirect:%{['var1']}?%{['var2']}=%{['var3']}"); + string resultUri = result.GetRedirectUri( MakeDictionary("var1", "val1", "var2", "val2", "var3", "val3") ); + Assert.AreEqual( "val1?val2=val3", resultUri ); + } - private IDictionary MakeDictionary( params object[] args) - { - AssertUtils.IsTrue(args.Length % 2 == 0); - Hashtable ht= new Hashtable(); - for(int i=0;i