using System;
namespace NUnit.Framework
{
///
/// Class to assert that the actual value is greater than the expected value.
///
public class LessAsserter : ComparisonAsserter
{
///
/// Constructs a GreaterAsserter for two objects implementing IComparable
///
/// The expected value
/// The actual value
/// The message to issue on failure
/// Arguments to apply in formatting the message
public LessAsserter( IComparable expected, IComparable actual, string message, params object[] args )
: base( expected, actual, message, args ) { }
///
/// Test whether the actual is greater than the expected, building up
/// the failure message for later use if they are not.
///
/// True if actual is greater than expected
public override bool Test()
{
if ( ((IComparable)actual).CompareTo(expected) < 0 ) return true;
DisplayDifferences();
return false;
}
private void DisplayDifferences()
{
FailureMessage.AddExpectedLine( string.Format( "Value less than {0}", expected ) );
FailureMessage.AddActualLine(actual.ToString());
}
}
}