~nunit-core/nunitv2/2.5

« back to all changes in this revision

Viewing changes to src/NUnitFramework/core/TestCase.cs

  • Committer: jnewkirk
  • Date: 2002-07-10 20:00:13 UTC
  • Revision ID: vcs-imports@canonical.com-20020710200013-j8us5mbi0usp7p02
initialĀ load

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//
 
2
// Copyright (C) 2002. James W. Newkirk, Michael C. Two, Alexei A. Vorontsov. All Rights Reserved.
 
3
//
 
4
namespace Nunit.Core
 
5
{
 
6
        using System;
 
7
 
 
8
        /// <summary>
 
9
        /// Summary description for TestCase.
 
10
        /// </summary>
 
11
        public abstract class TestCase : Test
 
12
        {
 
13
                public TestCase(string path, string name) : base(path, name)
 
14
                {}
 
15
 
 
16
                public override int CountTestCases 
 
17
                {
 
18
                        get { return 1; }
 
19
                }
 
20
 
 
21
                public override TestResult Run(EventListener listener)
 
22
                {
 
23
                        TestCaseResult testResult = new TestCaseResult(this);
 
24
 
 
25
                        listener.TestStarted(this);
 
26
 
 
27
                        long startTime = DateTime.Now.Ticks;
 
28
 
 
29
                        Run(testResult);
 
30
 
 
31
                        long stopTime = DateTime.Now.Ticks;
 
32
 
 
33
                        double time = ((double)(stopTime - startTime)) / (double)TimeSpan.TicksPerSecond;
 
34
 
 
35
                        testResult.Time = time;
 
36
 
 
37
                        listener.TestFinished(testResult);
 
38
        
 
39
                        return testResult;
 
40
                }
 
41
 
 
42
 
 
43
                public abstract void Run(TestCaseResult result);
 
44
 
 
45
        }
 
46
}