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

CallbackAsync throws throws Exception on Setup #8

Closed
SvetlovA opened this issue Aug 20, 2022 · 0 comments · Fixed by #9
Closed

CallbackAsync throws throws Exception on Setup #8

SvetlovA opened this issue Aug 20, 2022 · 0 comments · Fixed by #9
Assignees
Labels
bug Something isn't working

Comments

@SvetlovA
Copy link
Owner

If you throws custom exception from CallbackAsync this exception throws on setup

Failed test example:

    [Test]
    public async Task TestCallbackAsyncInstanceThrows()
    {
        var instance = new TestInstance();
        var originalResult = await instance.TestMethodReturnTaskWithoutParametersAsync();
        var expectedResult = 2;

        Assert.AreNotEqual(expectedResult, originalResult);

        Mock.Setup(() => instance.TestMethodReturnTaskWithoutParametersAsync(), async () =>
        {
            Assert.ThrowsAsync<Exception>(async () => await instance.TestMethodReturnTaskWithoutParametersAsync());
        }).CallbackAsync(() => throw new Exception());
    }
@SvetlovA SvetlovA added the bug Something isn't working label Aug 20, 2022
@SvetlovA SvetlovA self-assigned this Aug 20, 2022
@SvetlovA SvetlovA linked a pull request Aug 27, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant