Skip to content

Implement ExpectThrows #20

@Keboo

Description

@Keboo

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();
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions