2015-02-09 02:05:01 +03:00
|
|
|
using System;
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
|
|
|
namespace ExpectedExceptionExample
|
|
|
|
{
|
|
|
|
[TestFixture]
|
|
|
|
public class ExpectedExceptionTests
|
|
|
|
{
|
|
|
|
[Test]
|
|
|
|
[ExpectedException(typeof(ArgumentException))]
|
|
|
|
public void HandlesArgumentExceptionAsType()
|
|
|
|
{
|
|
|
|
throw new ArgumentException();
|
|
|
|
}
|
2023-10-06 01:30:07 +03:00
|
|
|
|
|
|
|
[Test]
|
|
|
|
public void HandlesArgumentExceptionWithNewSyntax()
|
|
|
|
{
|
|
|
|
Assert.Throws<ArgumentException>(() => throw new ArgumentException());
|
|
|
|
}
|
2015-02-09 02:05:01 +03:00
|
|
|
}
|
|
|
|
}
|