You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by hu...@apache.org on 2005/04/13 04:30:04 UTC

svn commit: r161144 - in struts/sandbox/trunk/overdrive/Nexus: Core/ Core/Helpers/ Extras/Spring/ Test/ Test/Helpers/ Test/Resources/Command/

Author: husted
Date: Tue Apr 12 19:30:00 2005
New Revision: 161144

URL: http://svn.apache.org/viewcvs?view=rev&rev=161144
Log:
OVR-5
* Add Tests, Interfaces, and Classes to realize protype for Directory code-behind. 
OVR-9 
* Add Tests for default IRequestCommand implementation
OVR-10
* Add Tests for default IViewHelper implementation. 
OVR-11
* Add Tests for default IListHelper, IEditHelper implementations.

Added:
    struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/
    struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/EditHelper.cs
    struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/IEditHelper.cs
    struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/IListHelper.cs
    struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/IViewHelper.cs
    struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/ListHelper.cs
    struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/ViewHelper.cs
    struts/sandbox/trunk/overdrive/Nexus/Test/Helpers/
    struts/sandbox/trunk/overdrive/Nexus/Test/Helpers/ViewHelperTest.cs
    struts/sandbox/trunk/overdrive/Nexus/Test/RequestCommandTest.cs
    struts/sandbox/trunk/overdrive/Nexus/Test/Resources/Command/AppConfig.xml
Modified:
    struts/sandbox/trunk/overdrive/Nexus/Core/Core.csproj
    struts/sandbox/trunk/overdrive/Nexus/Extras/Spring/Objects.cs
    struts/sandbox/trunk/overdrive/Nexus/Test/BaseNexusTest.cs
    struts/sandbox/trunk/overdrive/Nexus/Test/Test.csproj

Modified: struts/sandbox/trunk/overdrive/Nexus/Core/Core.csproj
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Core/Core.csproj?view=diff&r1=161143&r2=161144
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Core/Core.csproj (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Core/Core.csproj Tue Apr 12 19:30:00 2005
@@ -123,6 +123,36 @@
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
+                <File
+                    RelPath = "Helpers\EditHelper.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "Helpers\IEditHelper.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "Helpers\IListHelper.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "Helpers\IViewHelper.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "Helpers\ListHelper.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "Helpers\ViewHelper.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
             </Include>
         </Files>
     </CSHARP>

Added: struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/EditHelper.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/EditHelper.cs?view=auto&rev=161144
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/EditHelper.cs (added)
+++ struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/EditHelper.cs Tue Apr 12 19:30:00 2005
@@ -0,0 +1,63 @@
+ /*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * 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.
+ */
+
+namespace Nexus.Core.Helpers
+{
+	/// <summary>
+	/// Standard implementation of IEditHelper.
+	/// </summary>
+	public class EditHelper : ListHelper, IEditHelper
+	{
+		public const string msg_EDIT_COMMAND = "EDIT";
+		public const string msg_QUIT_COMMAND = "CANCEL";
+		public const string msg_SAVE_COMMAND = "SAVE";
+
+		public EditHelper () : base ()
+		{
+			EditText = msg_EDIT_COMMAND;
+			QuitText = msg_QUIT_COMMAND;
+			SaveText = msg_SAVE_COMMAND;
+		}
+
+		private string _EditText = null;
+		public virtual string EditText
+		{
+			get { return _EditText; }
+			set { _EditText = value; }
+		}
+
+		private string _QuitText = null;
+		public virtual string QuitText
+		{
+			get { return _QuitText; }
+			set { _QuitText = value; }
+		}
+
+		private string _SaveText = null;
+		public virtual string SaveText
+		{
+			get { return _SaveText; }
+			set { _SaveText = value; }
+		}
+
+		private string _SaveCommand = null;
+		public virtual string SaveCommand
+		{
+			get { return _SaveCommand; }
+			set { _SaveCommand = value; }
+		}
+	}
+}
\ No newline at end of file

Added: struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/IEditHelper.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/IEditHelper.cs?view=auto&rev=161144
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/IEditHelper.cs (added)
+++ struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/IEditHelper.cs Tue Apr 12 19:30:00 2005
@@ -0,0 +1,44 @@
+ /*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * 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.
+ */
+
+namespace Nexus.Core.Helpers
+{
+	/// <summary>
+	/// Helper for editing items, including items on a list [OVR-11].
+	/// </summary>
+	public interface IEditHelper : IListHelper
+	{
+		/// <summary>
+		/// Standard text to display for an Edit command (e.g. button).
+		/// </summary>		
+		string EditText { get; set; }
+
+		/// <summary>
+		/// Standard text to display for an Quit command (e.g. button).
+		/// </summary>		
+		string QuitText { get; set; }
+
+		/// <summary>
+		/// Standard text to display for an Save command (e.g. button).
+		/// </summary>		
+		string SaveText { get; set; }
+
+		/// <summary>
+		/// The ID of the command to execute for a Save operation. 
+		/// </summary>		
+		string SaveCommand { get; set; }
+	}
+}
\ No newline at end of file

Added: struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/IListHelper.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/IListHelper.cs?view=auto&rev=161144
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/IListHelper.cs (added)
+++ struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/IListHelper.cs Tue Apr 12 19:30:00 2005
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * 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.
+ */
+using System.Collections;
+
+namespace Nexus.Core.Helpers
+{
+	/// <summary>
+	/// Helper for controls that display a list [OVR-11].
+	/// </summary>
+	public interface IListHelper : IViewHelper
+	{
+		/// <summary>
+		/// Text to display as the title for a display. 
+		/// </summary>
+		string TitleText { get; set; }
+
+		/// <summary>
+		/// Text to display as a prompt to the user as to the next step.
+		/// </summary>
+		string PromptText { get; set; }
+
+		/// <summary>
+		/// ID of the command to execute to setup a Find dialog. 
+		/// </summary>
+		string FindCommand { get; set; }
+
+		/// <summary>
+		/// ID of the command to execute to list entries matching search critera.
+		/// </summary>
+		string ListCommand { get; set; }
+
+		/// <summary>
+		/// The name of the key field for a data set.
+		/// </summary>
+		string DataKeyField { get; set; }
+
+		/// <summary>
+		/// The list of field IDs to display as a row.
+		/// </summary>
+		IList DataFields { get; set; }
+
+		/// <summary>
+		/// The list of field labels to display with each column in a row (in the same order).
+		/// </summary>
+		/// <remarks>
+		/// If ommitted, the DataField ID is used instead.
+		/// </remarks>
+		IList DataLabels { get; set; }
+	}
+}
\ No newline at end of file

Added: struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/IViewHelper.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/IViewHelper.cs?view=auto&rev=161144
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/IViewHelper.cs (added)
+++ struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/IViewHelper.cs Tue Apr 12 19:30:00 2005
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * 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.
+ */
+using System;
+using Agility.Core;
+
+namespace Nexus.Core.Helpers
+{
+	/// <summary>
+	/// An encapsulation of the IRequestContext that hides some methods and exposes others in a more convenient way. 
+	/// </summary>
+	/// <remarks>
+	/// An IViewHelper implementation may also act as a "front controller" to ensure routine tasks are carried out.
+	/// </remarks>
+	public interface IViewHelper
+	{
+		/// <summary>
+		/// The IRequestContext we are processing.
+		/// </summary>
+		IRequestContext Context { get; set; }
+
+		/// <summary>
+		/// 
+		/// </summary>
+		IContext Errors { get; }
+
+		/// <summary>
+		/// Return true if errors are queued.
+		/// </summary>
+		/// <returns>True if errors are queued.</returns>
+		bool HasErrors { get; }
+
+		/// <summary>
+		/// 
+		/// </summary>
+		Exception Fault { get; }
+
+		/// <summary>
+		/// Return true if an exception is caught.
+		/// </summary>
+		/// <returns>True if an exception is caught.</returns>
+		bool HasFault { get; }
+
+		/// <summary>
+		/// Return true if there are no errors or exception pending.
+		/// </summary>
+		/// <returns>True if all is well.</returns>
+		bool IsNominal { get; }
+	}
+
+}
\ No newline at end of file

Added: struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/ListHelper.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/ListHelper.cs?view=auto&rev=161144
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/ListHelper.cs (added)
+++ struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/ListHelper.cs Tue Apr 12 19:30:00 2005
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * 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.
+ */
+using System.Collections;
+
+namespace Nexus.Core.Helpers
+{
+	/// <summary>
+	/// Standard implementation of IListHelper.
+	/// </summary>
+	public class ListHelper : ViewHelper, IListHelper
+	{
+		private string _TitleText = null;
+		public virtual string TitleText
+		{
+			get { return _TitleText; }
+			set { _TitleText = value; }
+		}
+
+		private string _PromptText = null;
+		public virtual string PromptText
+		{
+			get { return _PromptText; }
+			set { _PromptText = value; }
+		}
+
+		private string _FindCommand = null;
+		public virtual string FindCommand
+		{
+			get { return _FindCommand; }
+			set { _FindCommand = value; }
+		}
+
+		private string _ListCommand = null;
+		public virtual string ListCommand
+		{
+			get { return _ListCommand as string; }
+			set { _ListCommand = value; }
+		}
+
+		private string _DataKeyField = null;
+		public virtual string DataKeyField
+		{
+			get { return _DataKeyField; }
+			set { _DataKeyField = value; }
+		}
+
+		private IList _DataFields = null;
+		public virtual IList DataFields
+		{
+			get { return _DataFields; }
+			set { _DataFields = value; }
+		}
+
+		private IList _DataLabels = null;
+		public virtual IList DataLabels
+		{
+			get { return _DataLabels; }
+			set { _DataLabels = value; }
+		}
+	}
+}
\ No newline at end of file

Added: struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/ViewHelper.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/ViewHelper.cs?view=auto&rev=161144
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/ViewHelper.cs (added)
+++ struts/sandbox/trunk/overdrive/Nexus/Core/Helpers/ViewHelper.cs Tue Apr 12 19:30:00 2005
@@ -0,0 +1,118 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * 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.
+ */
+using System;
+using System.Collections;
+using System.Text;
+using Agility.Core;
+
+namespace Nexus.Core.Helpers
+{
+	/// <summary>
+	/// Standard implementation of IViewHelper.
+	/// </summary>
+	public class ViewHelper : IViewHelper
+	{
+		public ViewHelper ()
+		{
+			Context = new RequestContext ();
+		}
+
+		/// <summary>
+		/// Build a set of error messages using HTML markup.
+		/// </summary>
+		/// <param name="errors">A list of error messages</param>
+		/// <returns>HTML markup presenting the errors.</returns>
+		public static string HtmlErrorList (IList errors)
+		{
+			StringBuilder sb = new StringBuilder ("<ul>");
+			foreach (object o in errors)
+			{
+				sb.Append ("<li>");
+				sb.Append (o.ToString ());
+				sb.Append ("</li>");
+			}
+			sb.Append ("</ul>");
+
+			return sb.ToString ();
+		}
+
+		/// <summary>
+		/// Build a set error messages using HTML markup.
+		/// </summary>
+		/// <param name="fault">An exception instance, if any</param>
+		/// <param name="store">A context listing errors, if any</param>
+		/// <returns>HTML markup presenting the errors.</returns>
+		public static string HtmlErrorBuilder (Exception fault, IContext store)
+		{
+			string errorMarkup = null;
+			if (store != null)
+			{
+				IList errors = new ArrayList ();
+				ICollection keys = store.Keys;
+				foreach (string key in keys)
+				{
+					IList sublist = store [key] as IList;
+					foreach (string message in sublist) errors.Add (message);
+				}
+				errorMarkup = HtmlErrorList (errors);
+			}
+
+			if (errorMarkup != null)
+			{
+				StringBuilder sb = new StringBuilder (errorMarkup);
+				return sb.ToString ();
+			}
+			return null;
+		}
+
+		public static string HtmlErrorBuilder (IViewHelper helper)
+		{
+			return HtmlErrorBuilder (helper.Fault, helper.Errors);
+		}
+
+		private IRequestContext _Context;
+		public IRequestContext Context
+		{
+			get { return _Context; }
+			set { _Context = value; }
+		}
+
+		public IContext Errors
+		{
+			get { return Context [Tokens.ERRORS] as IContext; }
+		}
+
+		public bool HasErrors
+		{
+			get { return Context.Contains (Tokens.ERRORS); }
+		}
+
+		public Exception Fault
+		{
+			get { return Context [Tokens.FAULT] as Exception; }
+		}
+
+		public bool HasFault
+		{
+			get { return Context.Contains (Tokens.FAULT); }
+		}
+
+		public bool IsNominal
+		{
+			get { return (!HasErrors && !HasFault); }
+		}
+	}
+}
\ No newline at end of file

Modified: struts/sandbox/trunk/overdrive/Nexus/Extras/Spring/Objects.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Extras/Spring/Objects.cs?view=diff&r1=161143&r2=161144
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Extras/Spring/Objects.cs (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Extras/Spring/Objects.cs Tue Apr 12 19:30:00 2005
@@ -30,7 +30,7 @@
 		private static string[] files = {
 			"/Resources/Command/AppConfig.xml",
 			"/Resources/Command/Catalog.xml"
-	};
+		};
 
 		private Objects ()
 		{

Modified: struts/sandbox/trunk/overdrive/Nexus/Test/BaseNexusTest.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Test/BaseNexusTest.cs?view=diff&r1=161143&r2=161144
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Test/BaseNexusTest.cs (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Test/BaseNexusTest.cs Tue Apr 12 19:30:00 2005
@@ -23,21 +23,37 @@
 namespace Nexus.Core
 {
 	/// <summary>
-	/// Summary description for BaseNexusTest.
+	/// Provide base SetUp method and convenience methods.
 	/// </summary>
 	[TestFixture]
 	public class BaseNexusTest
 	{
 		protected IController controller;
 
+		/// <summary>
+		/// Setup controller between tests.
+		/// </summary>
 		[SetUp]
 		public virtual void SetUp ()
 		{
 			// TODO: Implement Objects.Factory [OVR-8]
 			IApplicationContext factory = Objects.Factory ();
-			controller = new Controller (factory);
+			controller = new Controller (factory); // sic
 		}
 
+		/// <summary>
+		/// Exercise SetuP method.
+		/// </summary>
+		[Test]
+		public void AssertSetUp ()
+		{
+			Assert.IsTrue (controller != null, "Expected non-null controller.");
+		}
+
+		/// <summary>
+		/// Convenience method to confirm that no Exception was caught.
+		/// </summary>
+		/// <param name="context">Context under test</param>
 		public void AssertNoFault (IRequestContext context)
 		{
 			bool hasFault = context.HasFault;
@@ -45,6 +61,10 @@
 				Assert.Fail (context.Fault.Message);
 		}
 
+		/// <summary>
+		/// Convenience method to confirm that there are no errors or Exception.
+		/// </summary>
+		/// <param name="context">Context under test</param>
 		public void AssertNominal (IRequestContext context)
 		{
 			AssertNoFault (context);

Added: struts/sandbox/trunk/overdrive/Nexus/Test/Helpers/ViewHelperTest.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Test/Helpers/ViewHelperTest.cs?view=auto&rev=161144
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Test/Helpers/ViewHelperTest.cs (added)
+++ struts/sandbox/trunk/overdrive/Nexus/Test/Helpers/ViewHelperTest.cs Tue Apr 12 19:30:00 2005
@@ -0,0 +1,128 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * 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.
+ */
+using System;
+using Agility.Core;
+using NUnit.Framework;
+
+namespace Nexus.Core.Helpers
+{
+	/// <summary>
+	/// Exercise methods of standard IViewHelper implementation.
+	/// </summary>
+	[TestFixture]
+	public class ViewHelperTest
+	{
+		private IViewHelper helper;
+
+		/// <summary>
+		/// Create a command in between test runs. 
+		/// </summary>
+		[SetUp]
+		public void SetUp ()
+		{
+			helper = new ViewHelper ();
+		}
+
+		/// <summary>
+		/// An error message will be returned surrounded by markup.
+		/// </summary>
+		[Test]
+		public void HtmlErrorBuilder ()
+		{
+			string ERROR = "Global error!";
+			helper.Context.AddError (ERROR);
+			string errors = ViewHelper.HtmlErrorBuilder (helper);
+			Assert.IsNotNull (errors, "Expected markup string.");
+			Assert.IsTrue (errors.Length > ERROR.Length);
+			Assert.IsTrue (errors.IndexOf (ERROR) > 0, "Expected error within markup.");
+		}
+
+
+		/// <summary>
+		/// A ViewHelper will have a non-null Context.
+		/// </summary>
+		[Test]
+		public void Context ()
+		{
+			Assert.IsNotNull (helper.Context, "Expected default Context instance.");
+		}
+
+		/// <summary>
+		/// Errors added to the underlying Context pass through to ViewHelper Errors.
+		/// </summary>
+		[Test]
+		public void Errors ()
+		{
+			Assert.IsNull (helper.Errors, "Expected no errors yet.");
+			IContext errors = new Context ();
+			errors.Add ("ERROR", "Error Message");
+			helper.Context.Errors = errors;
+			IContext _errors = helper.Errors;
+			Assert.IsNotNull (_errors, "Expected errors to pass through.");
+			Assert.IsTrue (_errors.Count == 1, "Expeced one error.");
+			Assert.AreEqual (errors [0], _errors [0]);
+		}
+
+		/// <summary>
+		/// Errors added to the underlying Context register with HasErrors.
+		/// </summary>
+		[Test]
+		public void HasErrors ()
+		{
+			Assert.IsFalse (helper.HasErrors, "Expected no errors.");
+			string ERROR = "I have an error!";
+			helper.Context.AddError (ERROR);
+			Assert.IsTrue (helper.HasErrors, "Expected to have errors.");
+		}
+
+		/// <summary>
+		/// An Exception added to the underlying Context passes through to the ViewHelper Fault.
+		/// </summary>
+		public void Fault ()
+		{
+			Assert.IsNull (helper.Fault, "Expected null fault.");
+			Exception fault = new Exception ();
+			helper.Context.Fault = fault;
+			Assert.IsNotNull (helper.Fault, "Expected non-null fault.");
+		}
+
+		/// <summary>
+		/// An Exception added to the underlying Context registers with ViewContext HasFault.
+		/// </summary>
+		[Test]
+		public void HasFault ()
+		{
+			Assert.IsFalse (helper.HasFault, "Expected no fault.");
+			helper.Context.Fault = new Exception ();
+			Assert.IsTrue (helper.HasFault, "Expected a fault");
+		}
+
+		/// <summary>
+		/// An Exception or error added to the underlying Context registers with IsNominal.
+		/// </summary>
+		[Test]
+		public void IsNominal ()
+		{
+			Assert.IsTrue (helper.IsNominal, "Expected nominal state.");
+			helper.Context.AddError ("Yet another error message.");
+			Assert.IsFalse (helper.IsNominal, "Expected error state");
+			helper.Context.Fault = new Exception ();
+			Assert.IsTrue (helper.HasFault, "Expected a fault");
+			Assert.IsFalse (helper.IsNominal, "Expected error state");
+		}
+
+	}
+}
\ No newline at end of file

Added: struts/sandbox/trunk/overdrive/Nexus/Test/RequestCommandTest.cs
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Test/RequestCommandTest.cs?view=auto&rev=161144
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Test/RequestCommandTest.cs (added)
+++ struts/sandbox/trunk/overdrive/Nexus/Test/RequestCommandTest.cs Tue Apr 12 19:30:00 2005
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ * 
+ * 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.
+ */
+using Nexus.Core.Commands;
+using NUnit.Framework;
+
+namespace Nexus.Core
+{
+	/// <summary>
+	/// Exercise methods of standard IRequestCommand implementation [OVR-9].
+	/// </summary>
+	[TestFixture]
+	public class RequestCommandTest
+	{
+		private IRequestCommand command;
+
+		/// <summary>
+		/// Create a default command between test runs. 
+		/// </summary>
+		[SetUp]
+		public void SetUp ()
+		{
+			command = new ListAll ();
+		}
+
+		/// <summary>
+		/// A NewContext is not null.
+		/// </summary>
+		[Test]
+		public void NewRequestContext ()
+		{
+			IRequestContext context = command.NewContext ();
+			Assert.IsNotNull (context, "Expected default context instance.");
+		}
+
+		/// <summary>
+		///  A successful command returns a nominal result.
+		/// </summary>
+		public void RequestExecute ()
+		{
+			IRequestContext context = command.NewContext ();
+			command.Execute (context);
+			Assert.IsTrue (context.IsNominal, "Expected nominal result.");
+		}
+
+	}
+}
\ No newline at end of file

Added: struts/sandbox/trunk/overdrive/Nexus/Test/Resources/Command/AppConfig.xml
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Test/Resources/Command/AppConfig.xml?view=auto&rev=161144
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Test/Resources/Command/AppConfig.xml (added)
+++ struts/sandbox/trunk/overdrive/Nexus/Test/Resources/Command/AppConfig.xml Tue Apr 12 19:30:00 2005
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8" ?> 
+<!DOCTYPE objects PUBLIC "-//SPRING//DTD OBJECT//EN"
+  "http://www.springframework.net/dtd/spring-objects.dtd">
+<objects>
+
+  <object id="Controller" type="Nexus.Extras.Spring.Controller, Nexus.Extras">
+  </object>
+
+</objects>
\ No newline at end of file

Modified: struts/sandbox/trunk/overdrive/Nexus/Test/Test.csproj
URL: http://svn.apache.org/viewcvs/struts/sandbox/trunk/overdrive/Nexus/Test/Test.csproj?view=diff&r1=161143&r2=161144
==============================================================================
--- struts/sandbox/trunk/overdrive/Nexus/Test/Test.csproj (original)
+++ struts/sandbox/trunk/overdrive/Nexus/Test/Test.csproj Tue Apr 12 19:30:00 2005
@@ -130,12 +130,22 @@
                     BuildAction = "Compile"
                 />
                 <File
+                    RelPath = "RequestCommandTest.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
                     RelPath = "RequestContextTest.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />
                 <File
                     RelPath = "Commands\ListAll.cs"
+                    SubType = "Code"
+                    BuildAction = "Compile"
+                />
+                <File
+                    RelPath = "Helpers\ViewHelperTest.cs"
                     SubType = "Code"
                     BuildAction = "Compile"
                 />



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org