~a-schlapsi/nunit-3.0/linux-makefile

« back to all changes in this revision

Viewing changes to src/tests/NUnit/Core/SetUpTest.cs

  • Committer: Andreas Schlapsi
  • Date: 2010-01-23 23:14:05 UTC
  • mfrom: (18.1.137 work)
  • Revision ID: a.schlapsi@gmx.at-20100123231405-17deqoh18nfnbq1j
Merged with trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
using System;
25
25
using NUnit.Framework;
 
26
using NUnit.Framework.Api;
26
27
using NUnit.Core.Builders;
27
28
using NUnit.TestUtilities;
28
29
using NUnit.TestData.SetUpTest;
29
30
 
30
 
namespace NUnit.Core.Tests
 
31
namespace NUnit.Framework.Tests
31
32
{
32
33
        [TestFixture]
33
34
        public class SetUpTest
108
109
            Exception e = new Exception("Test message for exception thrown from setup");
109
110
            SetupAndTearDownExceptionFixture fixture = new SetupAndTearDownExceptionFixture();
110
111
            fixture.setupException = e;
111
 
            TestResult result = TestBuilder.RunTestFixture(fixture);
112
 
            Assert.IsTrue(result.HasResults, "Fixture test should have child result.");
113
 
            result = (TestResult)result.Results[0];
 
112
            ITestResult result = TestBuilder.RunTestFixture(fixture);
 
113
            Assert.IsTrue(result.Results != null, "Fixture test should have child result.");
 
114
            result = (ITestResult)result.Results[0];
114
115
            Assert.AreEqual(result.ResultState, ResultState.Error, "Test should be in error state");
115
 
            //TODO: below assert fails now, a bug?
116
 
            //Assert.AreEqual(result.FailureSite, FailureSite.SetUp, "Test should be failed at setup site");
117
116
            string expected = string.Format("{0} : {1}", e.GetType().FullName, e.Message);
118
117
            Assert.AreEqual(expected, result.Message);
119
118
        }
124
123
            Exception e = new Exception("Test message for exception thrown from tear down");
125
124
            SetupAndTearDownExceptionFixture fixture = new SetupAndTearDownExceptionFixture();
126
125
            fixture.tearDownException = e;
127
 
            TestResult result = TestBuilder.RunTestFixture(fixture);
128
 
            Assert.IsTrue(result.HasResults, "Fixture test should have child result.");
129
 
            result = (TestResult)result.Results[0];
 
126
            ITestResult result = TestBuilder.RunTestFixture(fixture);
 
127
            Assert.NotNull(result.Results, "Fixture test should have child result.");
 
128
            result = (ITestResult)result.Results[0];
130
129
            Assert.AreEqual(result.ResultState, ResultState.Error, "Test should be in error state");
131
 
            Assert.AreEqual(result.FailureSite, FailureSite.TearDown, "Test should be failed at tear down site");
132
130
            string expected = string.Format("TearDown : {0} : {1}", e.GetType().FullName, e.Message);
133
131
            Assert.AreEqual(expected, result.Message);
134
132
        }