2
0
mirror of https://github.com/9ParsonsB/Pulsar.git synced 2025-07-01 08:23:42 -04:00

Journals Now processed in own thread

Some invalid journal data is now handled
Journals now use polymorphic deserialization
Added Event names to all journal events
Remove unused controllers
This commit is contained in:
2024-05-24 17:57:10 +10:00
parent ae848e036d
commit efd0b3e0c0
297 changed files with 827 additions and 209 deletions

View File

@ -0,0 +1 @@
global using NUnit.Framework;

View File

@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.6.0"/>
<PackageReference Include="NUnit" Version="3.13.3"/>
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1"/>
<PackageReference Include="NUnit.Analyzers" Version="3.6.1"/>
<PackageReference Include="coverlet.collector" Version="6.0.0"/>
</ItemGroup>
</Project>

30
TestProject1/UnitTest1.cs Normal file
View File

@ -0,0 +1,30 @@
using System.Text.Json;
using System.Text.Json.Serialization;
namespace TestProject1;
public class Tests
{
[JsonPolymorphic(TypeDiscriminatorPropertyName = "event")]
[JsonDerivedType(typeof(ChildEvent), "child")]
public abstract class EventBase
{
[JsonPropertyName("timestamp")] public DateTimeOffset Timestamp { get; init; }
[JsonPropertyName("event")] public string Event { get; set; }
}
public class ChildEvent : EventBase;
[Test]
public void Test()
{
var json = """
{ "event": "child", "timestamp":"2024-05-20T12:36:10Z" }
""";
var obj = JsonSerializer.Deserialize<EventBase>(json)!;
Console.WriteLine(obj.Event); // ""
}
}