11using System ;
2+ using System . Collections . Generic ;
23using System . Linq ;
34using System . Net . Http ;
45using Microsoft . Extensions . Caching . Memory ;
@@ -42,6 +43,7 @@ public TestContext(IHttpClientFactory httpClientFactory, OneFuzzLoggerProvider p
4243 ReproOperations = new ReproOperations ( provider . CreateLogger < ReproOperations > ( ) , this ) ;
4344 Reports = new Reports ( provider . CreateLogger < Reports > ( ) , Containers ) ;
4445 NotificationOperations = new NotificationOperations ( provider . CreateLogger < NotificationOperations > ( ) , this ) ;
46+ JobCrashReportedOperations = new JobCrashReportedOperations ( provider . CreateLogger < JobCrashReportedOperations > ( ) , this ) ;
4547
4648 FeatureManagerSnapshot = new TestFeatureManagerSnapshot ( ) ;
4749 WebhookOperations = new TestWebhookOperations ( httpClientFactory , provider . CreateLogger < WebhookOperations > ( ) , this ) ;
@@ -65,9 +67,28 @@ public Async.Task InsertAll(params EntityBase[] objs)
6567 InstanceConfig ic => ConfigOperations . Insert ( ic ) ,
6668 Notification n => NotificationOperations . Insert ( n ) ,
6769 Webhook w => WebhookOperations . Insert ( w ) ,
70+ JobCrashReported crashReported => JobCrashReportedOperations . Insert ( crashReported ) ,
6871 _ => throw new NotSupportedException ( $ "You will need to add an TestContext.InsertAll case for { x . GetType ( ) } entities") ,
6972 } ) ) ;
7073
74+ public Async . Task InsertAll ( IEnumerable < EntityBase > objs )
75+ => Async . Task . WhenAll (
76+ objs . Select ( x => x switch {
77+ Task t => TaskOperations . Insert ( t ) ,
78+ Node n => NodeOperations . Insert ( n ) ,
79+ Pool p => PoolOperations . Insert ( p ) ,
80+ Job j => JobOperations . Insert ( j ) ,
81+ JobResult jr => JobResultOperations . Insert ( jr ) ,
82+ Repro r => ReproOperations . Insert ( r ) ,
83+ Scaleset ss => ScalesetOperations . Insert ( ss ) ,
84+ NodeTasks nt => NodeTasksOperations . Insert ( nt ) ,
85+ InstanceConfig ic => ConfigOperations . Insert ( ic ) ,
86+ Notification n => NotificationOperations . Insert ( n ) ,
87+ Webhook w => WebhookOperations . Insert ( w ) ,
88+ JobCrashReported crashReported => JobCrashReportedOperations . Insert ( crashReported ) ,
89+ _ => throw new NotSupportedException ( $ "You will need to add an TestContext.InsertAll case for { x . GetType ( ) } entities") ,
90+ } ) ) ;
91+
7192 // Implementations:
7293
7394 public IMemoryCache Cache { get ; }
@@ -109,6 +130,8 @@ public Async.Task InsertAll(params EntityBase[] objs)
109130
110131 public IWebhookMessageLogOperations WebhookMessageLogOperations { get ; }
111132
133+ public IJobCrashReportedOperations JobCrashReportedOperations { get ; }
134+
112135 // -- Remainder not implemented --
113136
114137 public IConfig Config => throw new System . NotImplementedException ( ) ;
@@ -143,4 +166,6 @@ public Async.Task InsertAll(params EntityBase[] objs)
143166 public IAdo Ado => throw new NotImplementedException ( ) ;
144167
145168 public IConfigurationRefresher ConfigurationRefresher => throw new NotImplementedException ( ) ;
169+
170+
146171}
0 commit comments