ConfigureAssembly Method
Configures which module the testbed runs, how its points map to the data provider, and which context (asset/element) is used during execution.
Definition
Namespace: GSharp.Testbed
Type: Program
Assembly: GSharp.Testbed.exe
private void ConfigureAssembly(AssemblyBuilder builder)
Parameters
builder AssemblyBuilder
A fluent assembly builder provided by the testbed host. Used for assembly-level configuration, particularly for adding modules to be tested.
Example
private void ConfigureAssembly(AssemblyBuilder builder)
{
builder.AddModule<TankVolume>(moduleBuilder => moduleBuilder
// ... configure points and contexts here
);
}
Remarks
This method is called by the RunTestbed() method in Program.Main() method during testbed initialization.
It is primarily used to specify which module(s) to include in the testbed run. The AssemblyBuilder that is passed to the method provides a fluent API for registering modules, configuring point mappings, and adding contexts. You will typically edit this method for every module you develop, as it defines the connection between your module code and the testbed's execution environment.
You will quickly discover that you need multiple module configurations for testing different modules. You may consider breaking each out into a separate function for clarity and ease of switching. For example,
private void ConfigureAssembly(AssemblyBuilder builder)
{
BuildTestContext1(builder);
//BuildTestContext2(builder);
//BuildTestContext3(builder);
// Or perhaps some other, more elegant switching mechanism if you have
// many contexts to manage.
}
private static void BuildTestContext1(AssemblyBuilder builder)
{
builder.AddModule<TankVolume>(moduleBuilder => moduleBuilder
// ... configure points and contexts here
);
}
private static void BuildTestContext2(AssemblyBuilder builder)
// ... and so on