@@ -321,8 +321,9 @@ public async Task CreateSymbolPackage_UnauthorizedUserWillGet403()
321321
322322 var controller = new TestableApiController ( GetConfigurationService ( ) ) ;
323323 controller . SetCurrentUser ( user ) ;
324-
325- var nuGetPackage = TestPackage . CreateTestPackageStream ( "theId" , "1.0.42" ) ;
324+ var packageId = "theId" ;
325+ var version = "1.0.42" ;
326+ var nuGetPackage = TestPackage . CreateTestPackageStream ( packageId , version ) ;
326327 controller . SetupPackageFromInputStream ( nuGetPackage ) ;
327328
328329 var package = new Package ( )
@@ -357,6 +358,16 @@ public async Task CreateSymbolPackage_UnauthorizedUserWillGet403()
357358
358359 // Assert
359360 ResultAssert . IsStatusCode ( result , HttpStatusCode . Unauthorized ) ;
361+
362+ controller . AuditingService . WroteRecord < FailedAuthenticatedOperationAuditRecord > (
363+ ( record ) =>
364+ {
365+ return
366+ record . UsernameOrEmail == user . Username &&
367+ record . Action == AuditedAuthenticatedOperationAction . SymbolsPackagePushAttemptByNonOwner &&
368+ record . AttemptedPackage . Id == packageId &&
369+ record . AttemptedPackage . Version == version ;
370+ } ) ;
360371 }
361372
362373 [ Fact ]
@@ -520,7 +531,13 @@ public async Task CreateSymbolPackage_WillCreateSymbolPackageSuccessfully()
520531 controller . MockTelemetryService . Verify (
521532 x => x . TrackSymbolPackagePushEvent ( It . IsAny < string > ( ) , It . IsAny < string > ( ) ) ,
522533 Times . Once ( ) ) ;
534+
523535 ResultAssert . IsStatusCode ( result , HttpStatusCode . Created ) ;
536+
537+ Assert . True ( controller . AuditingService . WroteRecord < PackageAuditRecord > ( ar =>
538+ ar . Action == AuditedPackageAction . SymbolsCreate
539+ && ar . Id == package . PackageRegistration . Id
540+ && ar . Version == package . Version ) ) ;
524541 }
525542
526543 [ Fact ]
0 commit comments