RunicWindowTestHostOptions class

Namespace Runic.Application.Testing in Runic.Application.Testing 0.23.0

public sealed class RunicWindowTestHostOptions

Configures a RunicWindowTestHost.

Constructors

RunicWindowTestHostOptions

public RunicWindowTestHostOptions()

No documentation.

Properties

ApplicationLocale

public string? ApplicationLocale { get; init; }

The application's locale (IRunicApplicationLocale) while the host runs, such as de: the host sets it before the window opens, as an application does at start, and every window without a RunicWindowTestHostOptions.Locale of its own follows it and any later switch. null, the default, leaves the application's locale as it is.

Remarks

RunicWindowTestHost.CreateWindowAsync and RunicWindowTestHost.Create set the IRunicApplicationLocale that the services register, which AddRunicWindowService() registers as a singleton, so its followers (such as a Translations context) switch too. Disposing the host, or the Window that CreateWindowAsync returned, sets it back to the locale it had before, also when the test switched it since: tests that share one provider do not inherit the language. A constructor's host, and a Create host whose services register none, start their own RunicWindowTestHost.ApplicationLocale in it.

CreateWindowAsync requires a registered IRunicApplicationLocale for it and awaits the switch. The constructors and Create are synchronous and wait for it and for the switch back. A value that is not a locale tag throws ArgumentException.

CloseDrain

public RunicCloseDrain? CloseDrain { get; init; }

The close drain of the Windows that RunicWindowTestHost.CreateWindowAsync opens whose RunicWindowOptions.CloseDrain is null, as a host's default. null, the default, is RunicCloseDrain.None.

Remarks

With a drain, RunicTestWindow.RequestUserCloseAsync returns once the close was decided, and the Window stays open (RunicTestWindow.IsDraining) with its page connected until its accepted work has ended or the drain's timeout passed on the Window's clock.

CreateId

public Func<string>? CreateId { get; init; }

Creates content reference ids and interaction request ids. Defaults to the sequence 1, 2, ..., so content routes are content1, content2, ...

FlowCultureFromLocale

public bool? FlowCultureFromLocale { get; init; }

Whether the window's requests run in the culture of its locale (WindowContentSessionOptions.FlowCultureFromLocale), for Windows whose RunicWindowOptions.FlowCultureFromLocale is null. null, the default, keeps the process's cultures.

IncludeFailureDetail

public bool? IncludeFailureDetail { get; init; }

Whether the window's Bridge error replies carry exception detail (WindowContentSessionOptions.IncludeFailureDetail). null, the default, includes it only in a Development environment.

Locale

public string? Locale { get; init; }

The window's own locale when the host starts, a BCP 47 tag such as de or ar, as a Window whose ViewModel sets IRunicWindowLocale.Locale before it opens: the page's first hello receives it, and with RunicWindowTestHostOptions.FlowCultureFromLocale the window's requests run in its culture. The window keeps it when the application's locale changes. null, the default, follows the application's locale (RunicWindowTestHostOptions.ApplicationLocale).

Remarks

It means the same on every host: the constructors, RunicWindowTestHost.Create, and every Window that RunicWindowTestHost.CreateWindowAsync opens, including the Windows its ViewModels open later. A locale the ViewModel sets through IRunicWindowLocale before the window opens takes precedence. To start the whole application in a language and switch it later, set RunicWindowTestHostOptions.ApplicationLocale instead. A value that is not 1 to 64 letters, digits and -, starting with a letter, throws ArgumentException.

LoggerFactory

public ILoggerFactory? LoggerFactory { get; init; }

Receives the window's Bridge, operation and mount logs.

MaximumInputBytes

public int? MaximumInputBytes { get; init; }

The largest Bridge input of the window, in UTF-8 bytes (WindowContentSessionOptions.MaximumInputBytes). null, the default, is 1 MiB.

MaximumPendingUploadBytes

public long? MaximumPendingUploadBytes { get; init; }

The most bytes that the window's unclaimed uploads may take at once (WindowContentSessionOptions.MaximumPendingUploadBytes), for Windows whose RunicWindowOptions.MaximumPendingUploadBytes is null. null, the default, is 1 GiB.

MaximumUploadBytes

public long? MaximumUploadBytes { get; init; }

The largest upload of the window (WindowContentSessionOptions.MaximumUploadBytes), which UploadAsync also applies. null, the default, is 256 MiB.

ModelContext

public IRunicModelContext? ModelContext { get; init; }

The model context the window graph must share, if any.

OperationShutdown

public CancellationToken OperationShutdown { get; init; }

Cancels window-owned operations when signalled, except those declared RunicOperationClose.Durable.

PublicationTimeout

public TimeSpan PublicationTimeout { get; init; }

How long a driver waits for a state publication. Delivery runs off the calling thread, so this is real time. Defaults to five seconds.

RootRoute

public string? RootRoute { get; init; }

The generated root route. Defaults to the ViewModel's generated name: shell for ShellViewModel.

TimeProvider

public TimeProvider? TimeProvider { get; init; }

The window's clock, which interaction deadlines and close timeouts use. Defaults to a new FakeTimeProvider, so time passes only when the test advances it. Register the same instance in the application's services to control its time too.

Validation

public RunicValidationOptions? Validation { get; init; }

How the window's Bridges write validation (WindowContentSessionOptions.Validation), such as RunicValidationOptions.TextFor. RunicWindowTestHost.Create(services) takes the services' RunicValidationOptions when this is null, and each Window that RunicWindowTestHost.CreateWindowAsync opens takes its scope's, as on Runic Desktop and CS-WebUI.

ViewLocator

public IRunicViewLocator? ViewLocator { get; init; }

Resolves .NET Views for presented content.