Add a more functional (i.e. fewer-stubs) implementation of System.Data.Linq.
[mono.git] / mcs / nunit24 / NUnitFixtures / fixtures / TestLoadFixture.cs
1 // ****************************************************************\r
2 // Copyright 2007, Charlie Poole\r
3 // This is free software licensed under the NUnit license. You may\r
4 // obtain a copy of the license at http://nunit.org/?p=license&r=2.4\r
5 // ****************************************************************\r
6 \r
7 using System;\r
8 using System.IO;\r
9 using System.Text;\r
10 using System.Collections;\r
11 using NUnit.Core;\r
12 using NUnit.Util;\r
13 \r
14 namespace NUnit.Fixtures\r
15 {\r
16         /// <summary>\r
17         /// Abstract base class for fixtures that load and run a test assembly.\r
18         /// </summary>\r
19         public abstract class TestLoadFixture : fit.ColumnFixture\r
20         {\r
21                 protected TestRunner testRunner;\r
22                 protected TestResult testResult;\r
23                 protected ResultSummarizer testSummary;\r
24 \r
25                 protected void LoadAndRunTestAssembly( fit.Parse cell, string testAssembly )\r
26                 {\r
27                         testRunner = new TestDomain();\r
28 \r
29                         if ( !testRunner.Load( new TestPackage(testAssembly) ) )\r
30                         {\r
31                                 this.wrong(cell);\r
32                                 cell.addToBody( string.Format( \r
33                                         "<font size=-1 color=\"#c08080\"> <i>Failed to load {0}</i></font>", testAssembly ) );\r
34 \r
35                                 return;\r
36                         }\r
37 \r
38                         testResult = testRunner.Run(NullListener.NULL);\r
39                         testSummary = new ResultSummarizer( testResult );\r
40 \r
41                         this.right( cell );\r
42                 }\r
43 \r
44                 public override void wrong(fit.Parse cell)\r
45                 {\r
46                         string body = cell.body;\r
47                         base.wrong (cell);\r
48                         cell.body = body;\r
49                 }\r
50 \r
51                 public int Skipped()\r
52                 {\r
53                         return testRunner.Test.TestCount - testSummary.ResultCount - testSummary.IgnoreCount;\r
54                 }\r
55 \r
56                 public int Tests()\r
57                 {\r
58                         return testRunner.Test.TestCount;\r
59                 }\r
60 \r
61                 public int Run()\r
62                 {\r
63                         return testSummary.ResultCount;\r
64                 }\r
65 \r
66                 public int Failures()\r
67                 {\r
68                         return testSummary.FailureCount;\r
69                 }\r
70 \r
71                 public int Ignored()\r
72                 {\r
73                         return testSummary.IgnoreCount;\r
74                 }\r
75         }\r
76 }\r