File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ using NSubstitute ;
2+ using Xunit ;
3+
4+ namespace Cake . Core . Tests . Unit
5+ {
6+ public sealed class SetupContextTests
7+ {
8+ public sealed class TheConstructor
9+ {
10+ [ Fact ]
11+ public void Returns_Empty_Tasks_When_Input_Is_Null ( )
12+ {
13+ var cakeContextMock = Substitute . For < ICakeContext > ( ) ;
14+ var cakeTaskInfoMock = Substitute . For < ICakeTaskInfo > ( ) ;
15+
16+ // Given, When
17+ var result = new SetupContext ( cakeContextMock , cakeTaskInfoMock , null ) ;
18+
19+ // Then
20+ Assert . NotNull ( result . TasksToExecute ) ;
21+ Assert . Empty ( result . TasksToExecute ) ;
22+ }
23+
24+ [ Fact ]
25+ public void Returns_Injected_Tasks_When_Input_Is_Not_Null ( )
26+ {
27+ var cakeContextMock = Substitute . For < ICakeContext > ( ) ;
28+ var cakeTaskInfoMock = Substitute . For < ICakeTaskInfo > ( ) ;
29+
30+ // Given, When
31+ var result = new SetupContext ( cakeContextMock , cakeTaskInfoMock , new [ ]
32+ {
33+ cakeTaskInfoMock
34+ } ) ;
35+
36+ // Then
37+ Assert . NotNull ( result . TasksToExecute ) ;
38+ Assert . Single ( result . TasksToExecute ) ;
39+ }
40+ }
41+ }
42+ }
You can’t perform that action at this time.
0 commit comments