@@ -20,6 +20,7 @@ public class BuildRunnerTests
20
20
private readonly Mock < ICommandLineResult > _commandLineResult = new ( ) ;
21
21
private readonly Mock < IStartInfo > _startInfo = new ( ) ;
22
22
private readonly Mock < IStartInfoDescription > _startInfoDescription = new ( ) ;
23
+ private readonly Mock < ICommandLineStatistics > _statistics = new ( ) ;
23
24
private readonly Mock < ICommandLine > _process = new ( ) ;
24
25
private readonly Mock < IProcessResultHandler > _processResultHandler = new ( ) ;
25
26
private readonly ProcessResult _processResult ;
@@ -59,7 +60,7 @@ public void ShouldRunBuildWhenHasHandler(bool handled)
59
60
. Callback < Output , IReadOnlyCollection < BuildMessage > , Action < BuildMessage > > ( ( o , _ , _ ) => { o . Handled = handled ; } ) ;
60
61
61
62
// When
62
- buildService . Run ( _process . Object , customHandler , TimeSpan . FromSeconds ( 1 ) ) ;
63
+ var result = buildService . Run ( _process . Object , customHandler , TimeSpan . FromSeconds ( 1 ) ) ;
63
64
64
65
// Then
65
66
output . Handled . ShouldBeTrue ( ) ;
@@ -68,6 +69,7 @@ public void ShouldRunBuildWhenHasHandler(bool handled)
68
69
_teamCityContext . VerifySet ( i => i . TeamCityIntegration = true ) ;
69
70
_teamCityContext . VerifySet ( i => i . TeamCityIntegration = false ) ;
70
71
_processResultHandler . Verify ( i => i . Handle ( _processResult , customHandler ) ) ;
72
+ _statistics . Verify ( i => i . Register ( new CommandLineInfo ( result , _processResult ) ) ) ;
71
73
}
72
74
73
75
[ Fact ]
@@ -89,14 +91,15 @@ public void ShouldRunBuildWhenHasNoHandler()
89
91
. Returns ( _processResult ) ;
90
92
91
93
// When
92
- buildService . Run ( _process . Object , default , TimeSpan . FromSeconds ( 1 ) ) ;
94
+ var result = buildService . Run ( _process . Object , default , TimeSpan . FromSeconds ( 1 ) ) ;
93
95
94
96
// Then
95
97
output . Handled . ShouldBeTrue ( ) ;
96
98
_defaultBuildMessagesProcessor . Verify ( i => i . ProcessMessages ( output , buildMessages , It . IsAny < Action < BuildMessage > > ( ) ) ) ;
97
99
_teamCityContext . VerifySet ( i => i . TeamCityIntegration = true ) ;
98
100
_teamCityContext . VerifySet ( i => i . TeamCityIntegration = false ) ;
99
101
_processResultHandler . Verify ( i => i . Handle ( _processResult , default ( Action < BuildMessage > ) ) ) ;
102
+ _statistics . Verify ( i => i . Register ( new CommandLineInfo ( result , _processResult ) ) ) ;
100
103
}
101
104
102
105
[ Fact ]
@@ -110,17 +113,17 @@ public async Task ShouldRunBuildAsync()
110
113
var handler = Mock . Of < Action < BuildMessage > > ( ) ;
111
114
112
115
// When
113
- await buildService . RunAsync ( _process . Object , handler , token ) ;
116
+ var result = await buildService . RunAsync ( _process . Object , handler , token ) ;
114
117
115
118
// Then
116
119
_teamCityContext . VerifySet ( i => i . TeamCityIntegration = true ) ;
117
120
_teamCityContext . VerifySet ( i => i . TeamCityIntegration = false ) ;
118
121
_processResultHandler . Verify ( i => i . Handle ( _processResult , handler ) ) ;
122
+ _statistics . Verify ( i => i . Register ( new CommandLineInfo ( result , _processResult ) ) ) ;
119
123
}
120
124
121
125
private BuildRunner CreateInstance ( ) =>
122
- new (
123
- _processRunner . Object ,
126
+ new ( _processRunner . Object ,
124
127
_host . Object ,
125
128
_teamCityContext . Object ,
126
129
_resultFactory ,
@@ -129,5 +132,6 @@ private BuildRunner CreateInstance() =>
129
132
_defaultBuildMessagesProcessor . Object ,
130
133
_customBuildMessagesProcessor . Object ,
131
134
_processResultHandler . Object ,
132
- _startInfoDescription . Object ) ;
135
+ _startInfoDescription . Object ,
136
+ _statistics . Object ) ;
133
137
}
0 commit comments