[gitattributes] Do CRLF normalization on sln/proj files
[mono-project.git] / mcs / nunit24 / NUnitCore / core / NUnitTestMethod.cs
blob477e85aeaca4acc152d99533a947c9654f69e962
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 // ****************************************************************
6 using System;
7 using System.Reflection;
9 namespace NUnit.Core
11 /// <summary>
12 /// Class to implement an NUnit test method
13 /// </summary>
14 public class NUnitTestMethod : TestMethod
16 #region Constructor
17 public NUnitTestMethod(MethodInfo method) : base(method)
19 this.setUpMethod = NUnitFramework.GetSetUpMethod(this.FixtureType);
20 this.tearDownMethod = NUnitFramework.GetTearDownMethod(this.FixtureType);
22 #endregion
24 #region TestMethod Overrides
25 /// <summary>
26 /// Run a test returning the result. Overrides TestMethod
27 /// to count assertions.
28 /// </summary>
29 /// <param name="testResult"></param>
30 public override void Run(TestCaseResult testResult)
32 base.Run(testResult);
34 testResult.AssertCount = NUnitFramework.GetAssertCount();
37 /// <summary>
38 /// Determine if an exception is an NUnit AssertionException
39 /// </summary>
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;
47 /// <summary>
48 /// Determine if an exception is an NUnit IgnoreException
49 /// </summary>
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;
56 #endregion