givenState

open override fun givenState(state: S, version: Int, block: WhenDsl<S>.() -> Unit)

Sets up the aggregate with a specific initial state and version.

This method directly initializes the aggregate with the provided state object and version number, bypassing event sourcing. This is useful for testing scenarios where you want to start with a known state without replaying historical events.

Parameters

state

the initial state object to set on the aggregate

version

the version number to assign to the aggregate state

block

the test scenario continuation using WhenDsl for command execution