examples of testing the domain using joliver commo

2020-07-10 06:35发布

问题:

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?

回答1:

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.



回答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.



回答3:

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.



回答4:

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