mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-16 11:58:09 +00:00
Convert agent_events
to C# & add tests (#2032)
### Function implementation Added implementation of `agent_events` function and some basic tests. Fixed several issues encountered in `TestOperations`. ### Additional JsonConverter The existing Python code for `agent_events` figures out which class to use only based upon the shape of the input, without a discriminator. I have added an additional `JsonConverter` named `SubclassConverter<T>` which will pick a subclass of `T` to deserialize into based upon what properties exist in the JSON. ### Enum helpers Converted some enum helpers to extension methods to make them a bit more readable.
This commit is contained in:
@ -20,6 +20,8 @@ public sealed class TestContext : IOnefuzzContext {
|
||||
NodeOperations = new NodeOperations(logTracer, this);
|
||||
JobOperations = new JobOperations(logTracer, this);
|
||||
NodeTasksOperations = new NodeTasksOperations(logTracer, this);
|
||||
TaskEventOperations = new TaskEventOperations(logTracer, this);
|
||||
NodeMessageOperations = new NodeMessageOperations(logTracer, this);
|
||||
}
|
||||
|
||||
public TestEvents Events { get; set; } = new();
|
||||
@ -49,6 +51,8 @@ public sealed class TestContext : IOnefuzzContext {
|
||||
public IJobOperations JobOperations { get; }
|
||||
public INodeOperations NodeOperations { get; }
|
||||
public INodeTasksOperations NodeTasksOperations { get; }
|
||||
public ITaskEventOperations TaskEventOperations { get; }
|
||||
public INodeMessageOperations NodeMessageOperations { get; }
|
||||
|
||||
// -- Remainder not implemented --
|
||||
|
||||
@ -66,11 +70,8 @@ public sealed class TestContext : IOnefuzzContext {
|
||||
|
||||
public IIpOperations IpOperations => throw new System.NotImplementedException();
|
||||
|
||||
|
||||
public ILogAnalytics LogAnalytics => throw new System.NotImplementedException();
|
||||
|
||||
public INodeMessageOperations NodeMessageOperations => throw new System.NotImplementedException();
|
||||
|
||||
public INotificationOperations NotificationOperations => throw new System.NotImplementedException();
|
||||
|
||||
public IPoolOperations PoolOperations => throw new System.NotImplementedException();
|
||||
|
Reference in New Issue
Block a user