%@ CodeTemplate Language="C#" TargetLanguage="C#" Description="Assert Tester Wrapper" %>
<%@ Property Name="ClassName" Type="System.String" Category="Options" Description="Prefix of the class name, Assert will be appended." %>
<%@ Property Name="ClassNamespace" Type="System.String" Category="Options" Description="Namespace of the wrapped class" %>
<%@ Import Namespace="System.Reflection" %>
<%@ Import Namespace="System.Collections" %>
<%@ Assembly Name="AssemblyHelper"%>
<%@ Import Namespace="AssemblyHelper" %>
// MbUnit project.
// http://mbunit.tigris.org
using System;
using <%= ClassNamespace %>;
namespace MbUnit.Core.Framework
{
///
/// Assertion helper for the class.
///
///
///
/// This class contains static helper methods to verify assertions on the
/// class.
///
///
/// This class was automatically generated. Do not edit (or edit the template).
///
///
public sealed class <%= FullClassName %>
{
#region Private constructor
private <%= FullClassName %>()
{}
#endregion
<% foreach(PropertyInfo pi in this.ClassType.GetProperties())
{
if (pi.PropertyType == typeof(bool))
{%>
///
/// Verifies that the property value
/// is true.
///
///
/// Instance containing the expected value.
///
public static void <%= IsPropertyName(pi) %>(
<%= ClassName%> actual
)
{
<% CheckNonNull("actual");%>
Assert.IsTrue(actual.<%= pi.Name %>,
"Property <%= pi.Name %> is false");
}
///
/// Verifies that the property value
/// is false.
///
///
/// Instance containing the expected value.
///
public static void <%= IsNotPropertyName(pi) %>(
<%= ClassName%> actual
)
{
<% CheckNonNull("actual");%>
Assert.IsFalse(actual.<%= pi.Name %>,
"Property <%= pi.Name %> is true");
}
<%}
%>
///
/// Verifies that the property value
/// of and are equal.
///
///
/// Instance containing the expected value.
///
///
/// Instance containing the tested value.
///
public static void <%= ArePropertyEqualName(pi) %>(
<%= ClassName%> expected,
<%= ClassName%> actual
)
{
<% CheckBothNull("expected","actual"); %>
<% CheckNonNull("expected");%>
<% CheckNonNull("actual");%>
<%= ArePropertyEqualName(pi)%>(expected.<%= pi.Name %>,actual);
}
///
/// Verifies that the property value
/// of is equal to .
///
///
/// Expected value.
///
///
/// Instance containing the tested value.
///
public static void <%= ArePropertyEqualName(pi) %>(
<%= pi.PropertyType %> expected,
<%= ClassName%> actual
)
{
<% if (!pi.PropertyType.IsValueType)
CheckBothNull("expected","actual");
%>
<% CheckNonNull("actual");%>
Assert.AreEqual(expected,actual.<%= pi.Name %>,
"Property <%= pi.Name %> not equal");
}
<%}%>
}
}