Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scalacheck for aggregates and projections #22

Merged
merged 28 commits into from
Feb 28, 2016
Merged

Conversation

svalaskevicius
Copy link
Owner

to cover #13

case object Decrement extends UnitCommand {
def run(sut: Sut) = sut.synchronized {
val action = sut.runner.db(agg, Counter.counterAggregate.handleCommand(Counter.Decrement))
sut.runner = sut.runner.run(action) match {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not particularly nice... I wonder if there is a better way?


property("fails when below zero") = CounterSpec.property()

private object CounterSpec extends AggregateCommands[Counter.Event, Counter.flow.StateData, Int] {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Fristi hi!

what do you think about this kind of test for an aggregate? I'll create a similar one for the door agg.

projections, however, will need something more clever than this...

is there an alternative approach you can think of?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late response! Been busy lately with moving/new job 😄

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem!

Congrats on a new job :)

@@ -0,0 +1,64 @@
import java.awt.print.Book
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Book? 😄

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops :) copy paste err.

@Fristi
Copy link
Contributor

Fristi commented Nov 28, 2015

I really like this direction! Especially the invariant property tests, great job! I have made some comments, see the diff

svalaskevicius pushed a commit that referenced this pull request Feb 28, 2016
Scalacheck for aggregates and projections
@svalaskevicius svalaskevicius merged commit 7038332 into master Feb 28, 2016
@svalaskevicius svalaskevicius deleted the scalacheck branch February 28, 2016 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants