示例#1
0
            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);
            }
示例#2
0
            public void Should_Set_Error_Reporter()
            {
                // Given
                var task = new ActionTask("task");

                // When
                task.SetErrorReporter(exception => { });

                // Then
                Assert.NotNull(task.ErrorReporter);
            }
示例#3
0
            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");
            }