Repository navigation
Getting Started
github-actions[bot] edited this page Dec 2, 2026
·
1 revision
Create a SimWorld with a fixed ulong seed and run your async scenario inside world.Run(...):
using Faultline;
var world = new SimWorld(new SimWorldOptions
{
Seed = 42,
StartTime = new DateTimeOffset(2026, 1, 1, 0, 0, 0, TimeSpan.Zero),
});
world.Run(async sim =>
{
sim.AddHost("node-a", async host =>
{
await host.DelayAsync(TimeSpan.FromSeconds(5));
// host.Clock.UtcNow is 2026-01-01T00:00:05Z
});
await sim.DelayAsync(TimeSpan.FromSeconds(10));
});To run unmodified production code (using DateTime.UtcNow, Task.Delay, Task.Run, Random.Shared, new Random(), Guid.NewGuid()) without referencing Faultline in your production project:
- Keep your production project completely free of Faultline references.
- In your test project, import
build/Faultline.targetsand list the target assemblies:
<PropertyGroup>
<FaultlineRewriteAssemblies>MyProductionAssembly</FaultlineRewriteAssemblies>
</PropertyGroup>
<Import Project="..\..\build\Faultline.targets" />On build, Faultline.Rewriter instruments MyProductionAssembly.dll in the test output directory. Outside a SimWorld, every rewritten call transparently passes through to the real .NET BCL.