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

Implement ExpectThrows #20

Open
Keboo opened this issue Nov 18, 2022 · 0 comments
Open

Implement ExpectThrows #20

Keboo opened this issue Nov 18, 2022 · 0 comments

Comments

@Keboo
Copy link
Member

Keboo commented Nov 18, 2022

Currently to do assertions on throwing methods requires doing a try/catch. It would be nice to mimic other assertion libraries that have a method for asserting on an exception being thrown.

try
{
    IntelliTect.TestTools.Console.ConsoleAssert.Expect(view,
    () =>
    {
        ExceptionHandling.Main();
    });
}
catch (FormatException)
{
    flag = true;
}

Assert.IsTrue(flag);

Would be better written similar to:

IntelliTect.TestTools.Console.ConsoleAssert.ExpectThrows<FormatException>(view,
() =>
{
    ExceptionHandling.Main();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant