Confidence

Testing & Native AOT

Write business-readable scenarios and ship without runtime type discovery.

Given / When / Then for the domain

Wyrd.Testing exercises slices and projections through JSON round trips so tests stay honest about message boundaries.

PaymentTests.cs
C#
[Fact]
public void an_order_is_never_charged_twice() =>
    Scenario.For(new ChargePaymentSlice())
        .Given(new PaymentCharged("A-1", 89m))      // what already happened
        .When(new ChargePayment("A-1", 89m))        // what is asked
        .ThenRejected(PaymentError.AlreadyCharged); // what the business decides

[Fact]
public void a_shipped_order_shows_as_shipped() =>
    Scenario.For(new OrderSummaries())
        .Given(new OrderPlaced("A-1", "KEYBOARD", 1, 89m), new OrderShipped("A-1"))
        .Then("A-1", new OrderSummary("A-1", "KEYBOARD", 1, 89m, "Shipped"));

Specifications check one decision at a time. To check a whole process against faults, duplicates and reordering, use Skuld simulation.

Source-generated serialization

Production code resolves registered names through your generated JsonSerializerContext; it does not depend on Type.GetType or runtime code generation.

ShopJson.cs
C#
[WyrdJsonContext]
[JsonSerializable(typeof(ChargePayment))]
[JsonSerializable(typeof(Payment))] // unions are stored polymorphically
public partial class ShopJson : JsonSerializerContext;

var shop = new InMemoryRuntime(ShopJson.Default);