What happened to Assert.DoesNotThrowAsync() in xUnit?

I just wanted to update the answer with current information (Sep 2019).

As Malcon Heck mentioned, using the Record class is preferred.
Looking at xUnit’s Github, I see that a current way to check for lack of exceptions thrown is like this

[Fact]
public async Task CanDeleteAllTempFiles() {
    var exception = await Record.ExceptionAsync(() => DocumentService.DeleteAllTempDocuments());
    Assert.Null(exception);
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)