Author: husted
Date: Tue Jan 9 14:20:53 2007
New Revision: 494623
URL: http://svn.apache.org/viewvc?view=rev&rev=494623
Log:
PhoneBook2 - Complete initial CRUD workflow.
Added:
struts/sandbox/trunk/overdrive/PhoneBook2/projects/Test/Commands/EditFixture.cs
struts/sandbox/trunk/overdrive/PhoneBook2/projects/Test/Commands/FormatEntry.cs
Added:
struts/sandbox/trunk/overdrive/PhoneBook2/projects/Test/Commands/EditFixture.cs
URL:
http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/PhoneBook2/projects/Test/Commands/EditFixture.cs?view=auto&rev=494623
==============================================================================
---
struts/sandbox/trunk/overdrive/PhoneBook2/projects/Test/Commands/EditFixture.cs
(added)
+++
struts/sandbox/trunk/overdrive/PhoneBook2/projects/Test/Commands/EditFixture.cs
Tue Jan 9 14:20:53 2007
@@ -0,0 +1,43 @@
+using System.Collections;
+using NUnit.Framework;
+
+namespace PhoneBook.Core.Commands
+{
+ /// <summary>
+ /// Exercise editing commands.
+ /// </summary>
+ ///
+ [TestFixture]
+ public class EditFixture : BaseTest
+ {
+
+ public const string ENTRY_KEY_VALUE =
"12345678-1234-123456789-1234567890AB";
+ public const string FIRST_NAME_VALUE = App.FIRST_NAME;
+ public const string LAST_NAME_VALUE = App.LAST_NAME;
+ public const string USER_NAME_VALUE = App.USER_NAME;
+ public const string EXTENSION_VALUE = "1234567890";
+ public const string HIRED_VALUE = "2002-07-31";
+ public const string HOURS_VALUE = "20";
+ public const string EDITOR_VALUE = "1";
+
+ protected override void Populate(IDictionary context)
+ {
+ context[App.ENTRY_KEY] = ENTRY_KEY_VALUE;
+ context[App.FIRST_NAME] = FIRST_NAME_VALUE;
+ context[App.LAST_NAME] = LAST_NAME_VALUE;
+ context[App.USER_NAME] = USER_NAME_VALUE;
+ context[App.EXTENSION] = EXTENSION_VALUE;
+ context[App.HIRED] = HIRED_VALUE;
+ context[App.HOURS] = HOURS_VALUE;
+ context[App.EDITOR] = EDITOR_VALUE;
+ }
+
+
+ [Test]
+ public void InsertDelete()
+ {
+ AssertInsertDelete(App.ENTRY_SAVE, App.ENTRY_KEY, ENTRY_KEY_VALUE,
App.ENTRY_DELETE);
+ }
+
+ }
+}
\ No newline at end of file
Added:
struts/sandbox/trunk/overdrive/PhoneBook2/projects/Test/Commands/FormatEntry.cs
URL:
http://svn.apache.org/viewvc/struts/sandbox/trunk/overdrive/PhoneBook2/projects/Test/Commands/FormatEntry.cs?view=auto&rev=494623
==============================================================================
---
struts/sandbox/trunk/overdrive/PhoneBook2/projects/Test/Commands/FormatEntry.cs
(added)
+++
struts/sandbox/trunk/overdrive/PhoneBook2/projects/Test/Commands/FormatEntry.cs
Tue Jan 9 14:20:53 2007
@@ -0,0 +1,61 @@
+/*
+ * 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.Helpers;
+using NUnit.Framework;
+
+namespace PhoneBook.Core.Commands
+{
+
+ /// <summary>
+ /// Exercise formatting processors.
+ /// </summary>
+ ///
+ [TestFixture]
+ public class FormatEntry : BaseTest
+ {
+
+ public const string ENTRY_KEY_VALUE_FORMAT =
"c5b6bbb1-66d6-49cb-9db6-743af6627828";
+
+ private AppEntry getAppEntry()
+ {
+ IViewHelper helper = catalog.GetHelperFor(App.ENTRY);
+ helper.Criteria[App.ENTRY_KEY] = ENTRY_KEY_VALUE_FORMAT;
+ helper.Execute();
+ AssertNominal(helper);
+ AppEntry entry = new AppEntry(helper.Criteria);
+ return entry;
+ }
+
+ [Test]
+ public void Hired()
+ {
+ AppEntry entry = getAppEntry();
+ string hired = entry.hired;
+ Assert.IsNotNull(hired, "Expected row to have a hired date in
string format.");
+ Assert.IsTrue(hired.Length < "##/##/#### ".Length, hired + ":
Expected short date format.");
+ }
+
+ [Test]
+ public void extension()
+ {
+ AppEntry entry = getAppEntry();
+ string extension = entry.extension;
+ Assert.IsNotNull(extension, "Expected each row to have an
extension.");
+ Assert.IsTrue(extension.Length > "1234567890".Length, extension +
": Expected formatted extension.");
+ }
+
+ }
+}
\ No newline at end of file