7

I'm looking for good examples of testing the domain using JOlivers CommonDomain and EventStore

I have been watching greg youngs videos and he has a nice simple abstract aggregate root test fixture.

is there anything like that which can be used with these libs?

Ruben Bartelink
  • 59,778
  • 26
  • 187
  • 249

4 Answers4

2

I just pushed up NEventStoreExample with code I gathered in various places (StackOverflow, Documently, Greg Young's skillcast).

It's a very basic implementation of NEventStore that uses CommonDomain to rebuild aggregate state and an EventSpecification base test class to test aggregate behaviour.

Community
  • 1
  • 1
Luiz Damim
  • 3,803
  • 2
  • 27
  • 31
2

Edit: due to the immaturity of and forced inheritance in CommonDomain, Documently/develop now rolls its own simpler EventRouter

Yes, I have a sample here: https://github.com/haf/Documently that shows how you can use it together and there are tests in there as well.

Basically, what it does is that is uses CommonDomain and EventStore together with a RavenDB database.

This is not an article, so I'm not including any essential parts of it. It's a sample project, which is what the questioner asks for. I don't know if the admins are stupid enough to believe the answer "I don't have any samples" is the true answer, but if they want to assert their authority, then why don't they delete the non answer that was selected as the "answer" by the questioner instead of deleting real and true answers.

Henrik
  • 9,714
  • 5
  • 53
  • 87
  • not sure what you're talking about with the last paragraph but thanks for the link - i'll take a look later :) –  Jan 23 '12 at 10:20
  • line 46 on https://github.com/haf/Documently/blob/develop/src/Documently.Infrastructure/Installers/EventStoreInstaller.cs#L46 seems to have a duplicate UsingRavenPersistence - is that a bug? –  Jan 28 '12 at 04:52
  • also, line 24 of https://github.com/pjvds/Scrumr/blob/master/src/Scrumr.Domain.Tests/AggregateRoots/ProjectScenarios/When_creating_new_Project.cs - the PublishedEvents property is now a list of UncommittedEvent and not SourcedEvent - do you have any idea what thats all about? –  Jan 28 '12 at 15:18
  • No, haven't seen that project. I haven't gone into NCQRS because it assumes 2PC and I don't want that (I want to have choice to have it). Fixed that bug - I know a slew more bugs in that solution, including some in common domain's caching of event streams in the repository, message re-ordering and such, but we're working on making Documently the no. 1 go-to place for these types of questions. – Henrik Jan 28 '12 at 20:15
  • Hey - is there some place I can ask about documently? I see https://github.com/haf/Documently/blob/develop/src/Documently.Specs/AggregateRootTestFixture.cs has been commnented out? Do you know why? –  Jan 30 '12 at 21:08
  • You can use the issues of the project to discuss it. Since it's a project for showcasing things, it's an issue if something is unclear. It's been commented out because I didn't have a use-case where I cared about Document AR state, so I didn't need it. I realize there are cases where I might need it though in the future though. I have removed it now. – Henrik Jan 31 '12 at 11:49
1

I found a very interesting spike here: http://pastebin.com/upZS72W0

morleyc
  • 2,169
  • 10
  • 48
  • 108
1

I doubt that there's any public sample code out there for testing a domain model using the CommonDomain and EventStore libraries. In many regards, there is very little public code on testing domain models that implement CQRS.

Notwithstanding, the same kinds of conventions found in Greg Young's sample code can easily be applied to the CommonDomain library. Furthermore, everything in both of those libraries adheres to an interface which should be relatively easy to mock, if necessary.

It sounds like I need to create a blog post on the subject.

Jonathan Oliver
  • 5,207
  • 32
  • 31