Combining ExpectedException and AutoData NUnit Addin in the same test assembly
[TestFixture]
public class TestFixture
{
[SetUp]
public new void Setup()
{
base.Setup();
Fixture.Customize<SystemUnderTest>(x => x.Without(system => system.Property));
}
[Test, AutoData]
public void WhateverTestName(SystemUnderTest sut)
{
//Arrange
//Act
//Assert
Assert.Throws<ArgumentNullException>(() => sut.MethodThatThrowsException());
}
}
public class SystemUnderTest
{
public void MethodThatThrowsException()
{
throws new ArgumentNullException();
}
public string Property {get; set;}
}
[NUnitAddin]
public class ClassWithAddin : Ploeh.AutoFixture.NUnit2.Addins.Addin
{
protected IFixture Fixture;
protected void Setup()
{
Fixture = new Fixture();
}
}