1 // ****************************************************************
2 // Copyright 2007, Charlie Poole
3 // This is free software licensed under the NUnit license. You may
4 // obtain a copy of the license at http://nunit.org/?p=license&r=2.4
5 // ****************************************************************
7 using System
.Reflection
;
12 /// Class to implement an NUnit test method
14 public class NUnitTestMethod
: TestMethod
17 public NUnitTestMethod(MethodInfo method
) : base(method
)
19 this.setUpMethod
= NUnitFramework
.GetSetUpMethod(this.FixtureType
);
20 this.tearDownMethod
= NUnitFramework
.GetTearDownMethod(this.FixtureType
);
24 #region TestMethod Overrides
26 /// Run a test returning the result. Overrides TestMethod
27 /// to count assertions.
29 /// <param name="testResult"></param>
30 public override void Run(TestCaseResult testResult
)
34 testResult
.AssertCount
= NUnitFramework
.GetAssertCount();
38 /// Determine if an exception is an NUnit AssertionException
40 /// <param name="ex">The exception to be examined</param>
41 /// <returns>True if it's an NUnit AssertionException</returns>
42 protected override bool IsAssertException(Exception ex
)
44 return ex
.GetType().FullName
== NUnitFramework
.AssertException
;
48 /// Determine if an exception is an NUnit IgnoreException
50 /// <param name="ex">The exception to be examined</param>
51 /// <returns>True if it's an NUnit IgnoreException</returns>
52 protected override bool IsIgnoreException(Exception ex
)
54 return ex
.GetType().FullName
== NUnitFramework
.IgnoreException
;