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

@ -81,28 +81,34 @@ namespace Nuclex.Support.Collections {
/// <summary>
/// Ensures that the Add() method of the read only collection throws an exception
/// </summary>
[Test, ExpectedException(typeof(NotSupportedException))]
[Test]
public void TestThrowOnAdd() {
ReadOnlyCollection<int> testCollection = new ReadOnlyCollection<int>(new int[0]);
(testCollection as ICollection<int>).Add(123);
Assert.Throws<NotSupportedException>(
delegate() { (testCollection as ICollection<int>).Add(123); }
);
}
/// <summary>
/// Ensures that the Remove() method of the read only collection throws an exception
/// </summary>
[Test, ExpectedException(typeof(NotSupportedException))]
[Test]
public void TestThrowOnRemove() {
ReadOnlyCollection<int> testCollection = new ReadOnlyCollection<int>(new int[0]);
(testCollection as ICollection<int>).Remove(123);
Assert.Throws<NotSupportedException>(
delegate() { (testCollection as ICollection<int>).Remove(123); }
);
}
/// <summary>
/// Ensures that the Clear() method of the read only collection throws an exception
/// </summary>
[Test, ExpectedException(typeof(NotSupportedException))]
[Test]
public void TestThrowOnClear() {
ReadOnlyCollection<int> testCollection = new ReadOnlyCollection<int>(new int[0]);
(testCollection as ICollection<int>).Clear();
Assert.Throws<NotSupportedException>(
delegate() { (testCollection as ICollection<int>).Clear(); }
);
}
/// <summary>
@ -118,7 +124,7 @@ namespace Nuclex.Support.Collections {
outputIntegers.Add(value);
}
CollectionAssert.AreEqual(inputIntegers, outputIntegers);
CollectionAssert.AreEqual(inputIntegers, outputIntegers);
}
/// <summary>