@@ -57,7 +57,6 @@ public void AfterEachTest()
5757 [ TestMethod ]
5858 public async Task ValidateSbomAsync_WithNoErrorsAndNoExceptions_ReturnsTrue ( )
5959 {
60- // Arrange
6160 var buildDropPath = "/test/drop" ;
6261 var outputPath = "/test/output.json" ;
6362 var specifications = new List < SbomSpecification > { new SbomSpecification ( "SPDX" , "2.2" ) } ;
@@ -68,7 +67,6 @@ public async Task ValidateSbomAsync_WithNoErrorsAndNoExceptions_ReturnsTrue()
6867 var errors = new List < FileValidationResult > ( ) ;
6968 var exceptions = new List < Exception > ( ) ;
7069
71- // Setup mocks
7270 configValidatorsMock . Setup ( cv => cv . GetEnumerator ( ) ) . Returns ( new List < ConfigValidator > ( ) . GetEnumerator ( ) ) ;
7371
7472 configurationMock . Setup ( c => c . ManifestInfo ) . Returns ( new ConfigurationSetting < IList < ManifestInfo > >
@@ -94,18 +92,15 @@ public async Task ValidateSbomAsync_WithNoErrorsAndNoExceptions_ReturnsTrue()
9492 sbomConfigProviderMock . Object ,
9593 fileSystemUtilsMock . Object ) ;
9694
97- // Act
9895 var result = await validator . ValidateSbomAsync ( buildDropPath , outputPath , specifications , manifestDirPath ) ;
9996
100- // Assert
10197 Assert . IsTrue ( result . IsSuccess ) ;
10298 Assert . AreEqual ( 0 , result . Errors . Count ) ;
10399 }
104100
105101 [ TestMethod ]
106102 public async Task ValidateSbomAsync_WithErrorsButNoExceptions_ReturnsFalse ( )
107103 {
108- // Arrange
109104 var buildDropPath = "/test/drop" ;
110105 var outputPath = "/test/output.json" ;
111106 var specifications = new List < SbomSpecification > { new SbomSpecification ( "SPDX" , "2.2" ) } ;
@@ -115,11 +110,10 @@ public async Task ValidateSbomAsync_WithErrorsButNoExceptions_ReturnsFalse()
115110
116111 var errors = new List < FileValidationResult >
117112 {
118- new FileValidationResult { ErrorType = Microsoft . Sbom . Api . Entities . ErrorType . MissingFile , Path = "/test/missing.txt" }
113+ new FileValidationResult { ErrorType = ErrorType . MissingFile , Path = "/test/missing.txt" }
119114 } ;
120115 var exceptions = new List < Exception > ( ) ;
121116
122- // Setup mocks
123117 configValidatorsMock . Setup ( cv => cv . GetEnumerator ( ) ) . Returns ( new List < ConfigValidator > ( ) . GetEnumerator ( ) ) ;
124118
125119 configurationMock . Setup ( c => c . ManifestInfo ) . Returns ( new ConfigurationSetting < IList < ManifestInfo > >
@@ -145,18 +139,15 @@ public async Task ValidateSbomAsync_WithErrorsButNoExceptions_ReturnsFalse()
145139 sbomConfigProviderMock . Object ,
146140 fileSystemUtilsMock . Object ) ;
147141
148- // Act
149142 var result = await validator . ValidateSbomAsync ( buildDropPath , outputPath , specifications , manifestDirPath ) ;
150143
151- // Assert
152144 Assert . IsFalse ( result . IsSuccess ) ;
153145 Assert . AreEqual ( 1 , result . Errors . Count ) ;
154146 }
155147
156148 [ TestMethod ]
157149 public async Task ValidateSbomAsync_WithNoErrorsButWithExceptions_ReturnsFalse ( )
158150 {
159- // Arrange
160151 var buildDropPath = "/test/drop" ;
161152 var outputPath = "/test/output" ; // Directory path, not file path
162153 var specifications = new List < SbomSpecification > { new SbomSpecification ( "SPDX" , "2.2" ) } ;
@@ -170,7 +161,6 @@ public async Task ValidateSbomAsync_WithNoErrorsButWithExceptions_ReturnsFalse()
170161 new InvalidOperationException ( "Cannot write to directory path" )
171162 } ;
172163
173- // Setup mocks
174164 configValidatorsMock . Setup ( cv => cv . GetEnumerator ( ) ) . Returns ( new List < ConfigValidator > ( ) . GetEnumerator ( ) ) ;
175165
176166 configurationMock . Setup ( c => c . ManifestInfo ) . Returns ( new ConfigurationSetting < IList < ManifestInfo > >
@@ -196,18 +186,15 @@ public async Task ValidateSbomAsync_WithNoErrorsButWithExceptions_ReturnsFalse()
196186 sbomConfigProviderMock . Object ,
197187 fileSystemUtilsMock . Object ) ;
198188
199- // Act
200189 var result = await validator . ValidateSbomAsync ( buildDropPath , outputPath , specifications , manifestDirPath ) ;
201190
202- // Assert
203191 Assert . IsFalse ( result . IsSuccess ) ;
204192 Assert . AreEqual ( 0 , result . Errors . Count ) ; // No validation errors, but should still fail due to exception
205193 }
206194
207195 [ TestMethod ]
208196 public async Task ValidateSbomAsync_WithBothErrorsAndExceptions_ReturnsFalse ( )
209197 {
210- // Arrange
211198 var buildDropPath = "/test/drop" ;
212199 var outputPath = "/test/output" ;
213200 var specifications = new List < SbomSpecification > { new SbomSpecification ( "SPDX" , "2.2" ) } ;
@@ -217,14 +204,13 @@ public async Task ValidateSbomAsync_WithBothErrorsAndExceptions_ReturnsFalse()
217204
218205 var errors = new List < FileValidationResult >
219206 {
220- new FileValidationResult { ErrorType = Microsoft . Sbom . Api . Entities . ErrorType . MissingFile , Path = "/test/missing.txt" }
207+ new FileValidationResult { ErrorType = ErrorType . MissingFile , Path = "/test/missing.txt" }
221208 } ;
222209 var exceptions = new List < Exception >
223210 {
224211 new InvalidOperationException ( "Cannot write to directory path" )
225212 } ;
226213
227- // Setup mocks
228214 configValidatorsMock . Setup ( cv => cv . GetEnumerator ( ) ) . Returns ( new List < ConfigValidator > ( ) . GetEnumerator ( ) ) ;
229215
230216 configurationMock . Setup ( c => c . ManifestInfo ) . Returns ( new ConfigurationSetting < IList < ManifestInfo > >
@@ -250,10 +236,8 @@ public async Task ValidateSbomAsync_WithBothErrorsAndExceptions_ReturnsFalse()
250236 sbomConfigProviderMock . Object ,
251237 fileSystemUtilsMock . Object ) ;
252238
253- // Act
254239 var result = await validator . ValidateSbomAsync ( buildDropPath , outputPath , specifications , manifestDirPath ) ;
255240
256- // Assert
257241 Assert . IsFalse ( result . IsSuccess ) ;
258242 Assert . AreEqual ( 1 , result . Errors . Count ) ;
259243 }
0 commit comments