Click or drag to resize

CadenceFixture Class

Used to run the Docker container on the current machine as a test fixture while tests are being performed and then deletes the container when the fixture is disposed.
Inheritance Hierarchy

Namespace:  Neon.Xunit.Cadence
Assembly:  Neon.Xunit.Cadence (in Neon.Xunit.Cadence.dll) Version: 2.14.0
public sealed class CadenceFixture : DockerComposeFixture

The CadenceFixture type exposes the following members.

Public methodCadenceFixture
Constructs the fixture.
Public propertyApplicationName
Returns the running application name or null if the compose file has not been started.
(Inherited from DockerComposeFixture.)
Public propertyClient
Returns the CadenceClient to be used to interact with Cadence.
Public propertyHttpClient
Returns a HttpClient suitable for submitting requests to the HttpClient instance web server.
Public propertyIsRunning
Returns true if the fixture has been initialized.
(Inherited from TestFixture.)
Public propertyProxyClient

Returns a HttpClient suitable for submitting requests to the associated cadence-proxy process.

Note Note
This will return null if the cadence-proxy process was disabled by the settings.
Public propertySettings
Returns the settings used to connect to the Cadence cluster.
Public propertyState
Used by unit test classes to persist arbitrary name/value information across individual unit tests.
(Inherited from TestFixture.)
Public methodDispose
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
(Inherited from TestFixture.)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodOnRestart
Called when an already started fixture is being restarted. This establishes a fresh Cadence connection.
(Overrides TestFixtureOnRestart.)
Public methodReset
This method completely resets the fixture by removing the Cadence container from Docker. Use Restart if you just want to restart a fresh Cadence instance.
(Overrides DockerComposeFixtureReset.)
Public methodRestart
Closes the existing Cadence connection and restarts the Cadence server and then establishes a new connection.
Public methodStart(Action)
Starts the fixture if it hasn't already been started including invoking the optional Action when the first time Start(Action) is called for a fixture instance.
(Inherited from TestFixture.)
Public methodStart(String, String, Boolean, String)

Starts the fixture by running a Docker compose application.

(Inherited from DockerComposeFixture.)
Public methodStart(CadenceSettings, String, String, String, LogLevel, Boolean, Boolean, String, Boolean, Boolean)

Starts a Cadence container if it's not already running. You'll generally want to call this in your test class constructor instead of Start(Action).

Public methodStartAsComposed(String, String, Boolean, String)
Used to start the fixture within a ComposedFixture.
(Inherited from DockerComposeFixture.)
Public methodStartAsComposed(CadenceSettings, String, String, String, LogLevel, Boolean, Boolean, String, Boolean, Boolean)
Used to start the fixture within a ComposedFixture.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public fieldStatic memberDefaultComposeFile
The default Docker compose file text used to spin up Temporal and its related services by the CadenceFixture.
Public fieldStatic memberDefaultDomain
The default domain configured for CadenceFixture clients.
Note Note

IMPORTANT: The base Neon TestFixture implementation DOES NOT support parallel test execution because fixtures may impact global machine state like starting a Docker container, modifying the local DNS hosts file, or configuring a test database.

You should explicitly disable parallel execution in all test assemblies that rely on test fixtures by adding a C# file called AssemblyInfo.cs with:

[assembly: CollectionBehavior(DisableTestParallelization = true, MaxParallelThreads = 1)]

and then define your test classes like:

public class MyTests
    [CollectionDefinition(TestCollection.NonParallel, DisableParallelization = true)]
    public void Test()

This fixture assumes that Cadence is not currently running on the local workstation or as a container named cadence-dev. You may see port conflict errors if either of these conditions are not true.

See Start(CadenceSettings, String, String, String, LogLevel, Boolean, Boolean, String, Boolean, Boolean) for more information about how this works.

Note Note
You can persist CadenceClient instances to the underlying State dictionary to make these clients available across all test methods. CadenceFixture ensures that any of these clients will be disposed when the fixture is disposed, reset, or restarted.
Thread Safety
Instance members of this type are safe for multi-threaded operations.
See Also