This repository was archived by the owner on Jul 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
src/NuGet.Services.Validation.Orchestrator
tests/NuGet.Services.Validation.Orchestrator.Tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -137,12 +137,13 @@ private void TrackValidationStatus(PackageValidation packageValidation)
137137 packageValidation . Type ,
138138 isSuccess ) ;
139139
140+ var issues = ( packageValidation . PackageValidationIssues ?? Enumerable . Empty < PackageValidationIssue > ( ) ) . ToList ( ) ;
140141 _telemetryService . TrackValidationIssueCount (
141- packageValidation . PackageValidationIssues . Count ,
142+ issues . Count ,
142143 packageValidation . Type ,
143144 isSuccess ) ;
144145
145- foreach ( var issue in packageValidation ? . PackageValidationIssues ?? Enumerable . Empty < PackageValidationIssue > ( ) )
146+ foreach ( var issue in issues )
146147 {
147148 _telemetryService . TrackValidationIssue ( packageValidation . Type , issue . IssueCode ) ;
148149
Original file line number Diff line number Diff line change @@ -250,6 +250,23 @@ public async Task DoesNotEmitTelemtryForIncomplete()
250250 // Assert
251251 _telemetryService . VerifyAll ( ) ;
252252 }
253+
254+ [ Theory ]
255+ [ InlineData ( ValidationStatus . Failed ) ]
256+ [ InlineData ( ValidationStatus . Incomplete ) ]
257+ [ InlineData ( ValidationStatus . Succeeded ) ]
258+ public async Task DoesNotThrowWhenPackageValidationIssuesIsNull ( ValidationStatus validationStatus )
259+ {
260+ // Arrange
261+ _packageValidation . PackageValidationIssues = null ;
262+ var validationResult = new ValidationResult ( validationStatus ) ;
263+
264+ // Act
265+ var ex = await Record . ExceptionAsync ( async ( ) => await ExecuteAsync ( validationResult ) ) ;
266+
267+ // Assert
268+ Assert . Null ( ex ) ;
269+ }
253270 }
254271
255272 public abstract class Facts
You can’t perform that action at this time.
0 commit comments