/*
* 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 Nexus.Core;
using NUnit.Framework;
namespace PhoneBook.Core
{
///
/// Provide base class so unit tests can share utility.
///
///
[TestFixture]
public class BaseTest : CatalogBaseTest
{
///
/// Confirm that the outcome is a non-null, non-empty list.
///
/// Context to confirm
/// The non-null, non-empty list
///
protected IList AssertListOutcome(IRequestContext context)
{
AssertNominal(context);
Assert.IsTrue(context.HasOutcome, "Expected command to set an Outcome.");
IList list = context.Outcome as IList;
bool notEmpty = ((list != null) && (list.Count > 0));
Assert.IsTrue(notEmpty, "Expected outcome to be a not-empty list");
return list;
}
///
/// Exercise the testing infrastructure.
///
///
[Test]
public void Pass()
{
}
///
/// Exercise GUID creation,
/// and provide a device for generating GUIDs if needed.
///
///
[Test]
public void GuidString()
{
IDictionary test = new Hashtable();
for (int i = 0; i < 10; i++)
{
string key = Guid.NewGuid().ToString();
Assert.IsNotNull(key);
Assert.IsTrue(36 == key.Length);
test.Add(key, key); // Add throws an exception on duplicate keys
}
}
}
}