public void Should_Throw_If_Setting_More_Than_One_Error_Handler() { // Given var task = new CakeTask("task"); task.SetErrorHandler(e => { }); // When var result = Record.Exception(() => task.SetErrorHandler(e => { })); // Then Assert.IsType <CakeException>(result); Assert.Equal("There can only be one error handler per task.", result?.Message); }
public void Should_Throw_If_Error_Handler_Is_Null() { // Given var task = new CakeTask("task"); // When var result = Record.Exception(() => task.SetErrorHandler(null)); // Then AssertEx.IsArgumentNullException(result, "errorHandler"); }
public void Should_Set_Error_Handler() { // Given var task = new CakeTask("task"); // When task.SetErrorHandler(e => { }); // Then Assert.NotNull(task.ErrorHandler); }
public void Should_Set_Error_Handler() { // Given var task = new CakeTask("task"); // When task.SetErrorHandler((e, c) => { }); // Then Assert.NotNull(task.ErrorHandler); Assert.IsType <Func <Exception, ICakeContext, Task> >(task.ErrorHandler); }