public void Should_Throw_If_Setting_More_Than_One_Error_Reporter() { // Given var task = new ActionTask("task"); task.SetErrorReporter(error => { }); // When var result = Record.Exception(() => task.SetErrorReporter(exception => { })); // Then Assert.IsType <CakeException>(result); Assert.Equal("There can only be one error reporter per task.", result?.Message); }
public void Should_Set_Error_Reporter() { // Given var task = new ActionTask("task"); // When task.SetErrorReporter(exception => { }); // Then Assert.NotNull(task.ErrorReporter); }
public void Should_Throw_If_Error_Reporter_Is_Null() { // Given var task = new ActionTask("task"); // When var result = Record.Exception(() => task.SetErrorReporter(null)); // Then Assert.IsArgumentNullException(result, "errorReporter"); }