Replaced all ExpectedExceptionAttributes with the new Assert.Throws<>() method to work around a compatibility issue between TeamCity 4.5 and NUnit 2.5 Final

git-svn-id: file:///srv/devel/repo-conversion/nusu@137 d2e56fa2-650e-0410-a79f-9358c0239efd
This commit is contained in:
Markus Ewald 2009-05-07 19:36:27 +00:00
parent 06749b9cbb
commit d0fe47239e
20 changed files with 399 additions and 215 deletions

View file

@ -287,7 +287,7 @@ namespace Nuclex.Support.Scheduling {
/// Validates that the operation queue delivers an exception occuring in one of the
/// contained operations to the operation queue joiner
/// </summary>
[Test, ExpectedException(typeof(AbortedException))]
[Test]
public void TestExceptionPropagation() {
TestOperation operation1 = new TestOperation();
TestOperation operation2 = new TestOperation();
@ -307,7 +307,9 @@ namespace Nuclex.Support.Scheduling {
Assert.IsFalse(testQueueOperation.Ended);
operation2.SetEnded(new AbortedException("Hello World"));
testQueueOperation.Join();
Assert.Throws<AbortedException>(
delegate() { testQueueOperation.Join(); }
);
}
/// <summary>
@ -321,7 +323,7 @@ namespace Nuclex.Support.Scheduling {
);
WeightedTransaction<TestOperation> operation2 = new WeightedTransaction<TestOperation>(
new TestOperation()
);
);
OperationQueue<TestOperation> testQueueOperation =
new OperationQueue<TestOperation>(

View file

@ -110,7 +110,7 @@ namespace Nuclex.Support.Scheduling {
/// Verifies that the threaded operation forwards an exception that occurred in
/// a thread pool thread.
/// </summary>
[Test, ExpectedException(typeof(AbortedException))]
[Test]
public void TestForwardExceptionFromThreadPool() {
ThreadCallbackOperation test = new ThreadCallbackOperation(
new ThreadStart(errorCallback), false
@ -118,14 +118,16 @@ namespace Nuclex.Support.Scheduling {
Assert.IsFalse(test.Ended);
test.Start();
test.Join();
Assert.Throws<AbortedException>(
delegate() { test.Join(); }
);
}
/// <summary>
/// Verifies that the threaded operation forwards an exception that occurred in
/// an explicit thread.
/// </summary>
[Test, ExpectedException(typeof(AbortedException))]
[Test]
public void TestForwardExceptionFromExplicitThread() {
ThreadCallbackOperation test = new ThreadCallbackOperation(
new ThreadStart(errorCallback), false
@ -133,7 +135,9 @@ namespace Nuclex.Support.Scheduling {
Assert.IsFalse(test.Ended);
test.Start();
test.Join();
Assert.Throws<AbortedException>(
delegate() { test.Join(); }
);
}
/// <summary>

View file

@ -107,26 +107,30 @@ namespace Nuclex.Support.Scheduling {
/// Verifies that the threaded operation forwards an exception that occurred in
/// a thread pool thread.
/// </summary>
[Test, ExpectedException(typeof(AbortedException))]
[Test]
public void TestForwardExceptionFromThreadPool() {
FailingThreadOperation test = new FailingThreadOperation(true);
Assert.IsFalse(test.Ended);
test.Start();
test.Join();
Assert.Throws<AbortedException>(
delegate() { test.Join(); }
);
}
/// <summary>
/// Verifies that the threaded operation forwards an exception that occurred in
/// an explicit thread.
/// </summary>
[Test, ExpectedException(typeof(AbortedException))]
[Test]
public void TestForwardExceptionFromExplicitThread() {
FailingThreadOperation test = new FailingThreadOperation(false);
Assert.IsFalse(test.Ended);
test.Start();
test.Join();
Assert.Throws<AbortedException>(
delegate() { test.Join(); }
);
}
}