Closed SvetlovA closed 2 years ago
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()); }
If you throws custom exception from CallbackAsync this exception throws on setup
Failed test example: