예제 #1
0
            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);
            }
예제 #2
0
            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");
            }
예제 #3
0
            public void Should_Set_Error_Handler()
            {
                // Given
                var task = new CakeTask("task");

                // When
                task.SetErrorHandler(e => { });

                // Then
                Assert.NotNull(task.ErrorHandler);
            }
예제 #4
0
            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);
            }