// ****************************************************************
// Copyright 2007, Charlie Poole
// This is free software licensed under the NUnit license. You may
// obtain a copy of the license at http://nunit.org/?p=license&r=2.4
// ****************************************************************
using System;
using System.Reflection;
namespace NUnit.Core
{
///
/// Class to implement an NUnit test method
///
public class NUnitTestMethod : TestMethod
{
#region Constructor
public NUnitTestMethod(MethodInfo method) : base(method)
{
this.setUpMethod = NUnitFramework.GetSetUpMethod(this.FixtureType);
this.tearDownMethod = NUnitFramework.GetTearDownMethod(this.FixtureType);
}
#endregion
#region TestMethod Overrides
///
/// Run a test returning the result. Overrides TestMethod
/// to count assertions.
///
///
public override void Run(TestCaseResult testResult)
{
base.Run(testResult);
testResult.AssertCount = NUnitFramework.GetAssertCount();
}
///
/// Determine if an exception is an NUnit AssertionException
///
/// The exception to be examined
/// True if it's an NUnit AssertionException
protected override bool IsAssertException(Exception ex)
{
return ex.GetType().FullName == NUnitFramework.AssertException;
}
///
/// Determine if an exception is an NUnit IgnoreException
///
/// The exception to be examined
/// True if it's an NUnit IgnoreException
protected override bool IsIgnoreException(Exception ex)
{
return ex.GetType().FullName == NUnitFramework.IgnoreException;
}
#endregion
}
}