Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assert.Throws conversion loses expected message #16

Open
waf opened this issue Nov 22, 2018 · 1 comment
Open

Assert.Throws conversion loses expected message #16

waf opened this issue Nov 22, 2018 · 1 comment

Comments

@waf
Copy link
Member

waf commented Nov 22, 2018

Given

[Test, ExpectedException(typeof(ArgumentException), ExpectedMessage = "Must be bigger than zero")]
public void Foo()
{
    // method body
}

we convert it to

[Xunit.Fact]
public void Foo()
{
    Assert.Throws<ArgumentException>(() =>
    {
        // method body
    });
}

so we lose the ExpectedMessage assertion

@waf
Copy link
Member Author

waf commented Nov 22, 2018

NUnit also supports an additional parameter to ExpectedException that specifies the match should be "Contains" rather than exact string match.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant