#region License
/**
* Ingenious MVC : An MVC framework for .NET 2.0
* Copyright (C) 2006, JDP Group
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors: - Kent Boogaart (kentcb@internode.on.net)
*/
#endregion
using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using Ingenious.Mvc.Util;
namespace Ingenious.Mvc.UnitTest.Util{
/// <summary>
/// Unit tests the <see cref="ArgumentHelper"/> class.
/// </summary>
public sealed class ArgumentHelperTest : UnitTestBase
{
[Test]
[ExpectedException(typeof(ArgumentNullException))]
public void TestAssertNotNullIsNull()
{
ArgumentHelper.AssertNotNull((string) null, "test");
}
[Test]
public void TestAssertNotNullValid()
{
ArgumentHelper.AssertNotNull("not null", "test");
}
[Test]
[ExpectedException(typeof(IdException), "An empty ID of type Ingenious.Mvc.IView was illegally provided for argument 'test'.")]
public void TestAssertNotEmptyIsEmpty()
{
ArgumentHelper.AssertNotEmpty(Id<IView>.Empty, "test");
}
[Test]
public void TestAssertNotEmptyValid()
{
ArgumentHelper.AssertNotEmpty((Id<IView>) "id1", "test");
Id<IController> id;
id = "id2";
ArgumentHelper.AssertNotEmpty(id, "test");
}
[Test]
[ExpectedException(typeof(ArgumentException), "Enum value '69' is not defined for enumeration 'System.DayOfWeek'.")]
public void TestAssertEnumMemberInvalid()
{
ArgumentHelper.AssertEnumMember((DayOfWeek) 69);
}
[Test]
public void TestAssertEnumMemberValid()
{
ArgumentHelper.AssertEnumMember(DayOfWeek.Monday);
ArgumentHelper.AssertEnumMember((DayOfWeek) 3);
}
}
}
|