inspect state of AR in GivenWhenThenFixture?

When using GivenWhenThenFixture, can I test the internal state of the AR under test after .when() ?

e.g. “then expect member of type List of the AR under rtest to have size 2”

Hi Chris,

that’s not really the intention of the fixture. It’s meant to test whether your aggregate behaves correctly, not whether it captured a certain state.
If you want to test if an aggregate is in a correct state, see if the transitions from that state are correct. In other words, send some commands and see if the result is correct.

A correctly designed aggregate doesn’t even expose its state, so even if the fixture did allow you to do it, you’d have to violate cqrs rule #1 to get to it.

But if you really have to (you have been warned, though), you could try using the fixture’s repository to get an aggregate instance. I’m not sure what it takes to do it. You might have to ‘manually’ start a unit of work.