Skip to main content

RunAsAt Method

Configures the testbed to run the module "as at" a specific point in time, so that all data is read as it would have appeared at that moment.

Definition​

Namespace: GHost.GSharp.Developer.Builder
Type: AssemblyBuilder
Assembly: GHost.GSharp.Developer.dll

public AssemblyBuilder RunAsAt(TimeExpression asAtTime)

Parameters​

asAtTime TimeExpression
A time expression understood by the testbed (for example, "13-Feb-2025 14:30:00"). The exact formats accepted are aligned with the gSharp server and testbed time parsing rules.

Return Value​

AssemblyBuilder
The same builder instance, to allow fluent configuration.

Example​

private void ConfigureAssembly(AssemblyBuilder builder)
{
builder
.AddModule<TankVolume>(
// ... configure points and contexts here
)
.RunAsAt("13-Feb-2025 14:30:00");
}

This example will cause the testbed to run the TankVolume module as if the current time were 2:30 PM on February 13, 2025. All data read by the module will be from that point in time, allowing you to reproduce historical scenarios or test against fixed data snapshots.

Remarks​

Running the testbed in "as at" mode is useful when you want to reproduce historical scenarios deterministically. The module reads data as it existed at the specified time rather than using live or rolling windows.

If you do not call RunAsAt, the testbed uses the current time as the test execution timestamp.

The TimeExpression parameter is a flexible type that can accept the following types:

  • A string as a local date/time in a recognized locale format (e.g., "13-Feb-2025 14:30:00").
  • A DateTime object.
  • A relative time expression (e.g., "now", "Today", "*-1 day", etc.) that the testbed can parse.
  • A long value representing Ticks.
  • Any other object whose ToString() method returns a parsable time expression.

See Also​