public async Task HandleAsync_ThrowsAnExceptionForNullNotification() { // Arrange var handler = new OpenIddictValidationEventHandler <Event>( notification => Task.FromResult(OpenIddictValidationEventState.Handled)); // Act and assert var exception = await Assert.ThrowsAsync <ArgumentNullException>(() => handler.HandleAsync(notification: null)); Assert.Equal("notification", exception.ParamName); }
public async Task HandleAsync_InvokesInlineHandler() { // Arrange var marker = false; var handler = new OpenIddictValidationEventHandler <Event>( notification => { marker = true; return(Task.FromResult(OpenIddictValidationEventState.Handled)); }); // Act await handler.HandleAsync(new Event()); // Assert Assert.True(marker); }