Ejemplo n.º 1
0
            public void Should_Throw_If_Setting_More_Than_One_Finally_Handler()
            {
                // Given
                var task = new ActionTask("task");

                task.SetFinallyHandler(() => { });

                // When
                var result = Record.Exception(() => task.SetFinallyHandler(() => { }));

                // Then
                Assert.IsType <CakeException>(result);
                Assert.Equal("There can only be one finally handler per task.", result?.Message);
            }
Ejemplo n.º 2
0
            public void Should_Set_Finally_Handler()
            {
                // Given
                var task = new ActionTask("task");

                // When
                task.SetFinallyHandler(() => { });

                // Then
                Assert.NotNull(task.FinallyHandler);
            }
Ejemplo n.º 3
0
            public void Should_Throw_If_Finally_Handler_Is_Null()
            {
                // Given
                var task = new ActionTask("task");

                // When
                var result = Record.Exception(() => task.SetFinallyHandler(null));

                // Then
                Assert.IsArgumentNullException(result, "finallyHandler");
            }