yreynhout / AggregateSource

Lightweight infrastructure for doing eventsourcing using aggregates
BSD 3-Clause "New" or "Revised" License
257 stars 60 forks source link

Add sugar to testing syntax to explicitly state there are no givens/thens #13

Closed yreynhout closed 11 years ago

yreynhout commented 11 years ago
new Scenario().
  GivenNone().
  When().
  Then().
  Build();

new Scenario().
  Given().
  When().
  ThenNone().
  Build();

From a twonversation with @jen20 on twitter: https://twitter.com/jen20/status/361957163750539264

yreynhout commented 11 years ago

specification state chart This would be the new statechart, with the blue states indicating both what's new and transient.

jen20 commented 11 years ago

Yup that's pretty much what I was thinking. I have an impl of the the ThenNone if you want a PR, haven't looked at GivenNone none though (have been using ConstructorScenarioFor<T> there.

yreynhout commented 11 years ago

Well, both GivenNone and ThenNone can be achieved "today" in the following ways:

new Scenario().
  When().
  Then().
  Assert();

new Scenario().
  Given().
  When().
  AssertNothingHappened();

but as you mentioned that is only available on the Scenario class and not the Command/Query/Factory/ConstructorScenarioFor<TAggregateRoot> builders. Does your PR include an extra IAggregateXXXThenNoneStateBuilder? If not, I'd rather start from scratch, otherwise somebody could call ThenNone().Then(This).Then(That).Then(SomeMore).Build() which seems counter intuitive and leads down the wrong path.

yreynhout commented 11 years ago

Fixed as of 1b3c35a432b79fa0223dde810db40bc1b4cff18b