Comments (7)
Hi, what do you think about something similiar to what was create in here (BDD helpers): https://github.com/edumentab/cqrs-starter-kit/blob/master/starter-kit/YourDomainTests/SomethingTests.cs I started digging into cqrs/event sourcing recently, after I saw a way of testing in this starter - it seems so nice...
from eventflow.
@rstraszewski Yes, it is a good way of writing domain tests and definitely something that I will need to add support for. Its very, very similar to a custom DDD framework we have implemented at work. Writing easy to read tests is very important.
from eventflow.
@rasmus Look at LightBDD for some concepts. I use it with EventFlow at present but an integrated approach (#137 ) would be a winner if it supports similar features and concepts.
from eventflow.
@JC008 Thanks for the link. I have had a look but I don't think the first version will support other BDD frameworks directly. However, I will try to iterate on the solution a few times and be sure to expose as much of the inner workings as possible. As any other part of EventFlow, I would like it to be configurable and let developers decide the best method for their project. The solution in #137 works, but is still a very crude implementation, but the basic concepts are there and I will see if they can made available for use in other scenarios, e.g. using another BDD framework.
This is what I have been working on for the new BDD package for EventFlow, which is also what you would need to make use of any other BDD framework.
- Easy injection of events into aggregates (given)
- Easy command publishing (already there) (when)
- Easy access to the event stream (then)
- Detecting (domain) exceptions
I'm considering move the new IEventStream
to the core package as I could be useful in a desktop application. The injecting events will be added to the IAggregateRoot<>
so that will be accessible as well. The last thing you need is the exception logging, but I guess that will be an integrated part of any BDD framework.
Does this make sense, or am I just rambling...
from eventflow.
@rasmus Your'e not rambling at all. I only suggested looking at the concepts applied in LightBDD for guidance and ideas, not support it directly, as it makes it very easy and practical to work with (e.g. it provides a lot of control, recomposition and refactoring support).
A Bdd module in EventFlow which handles the EventFlow specifics is an excellent idea, if not essential due to the nature of CQRS+ES, to quote you're example:
resolver.Scenario()
.Given(c => c
.Event<PingEvent>()
.Event<DomainErrorAfterFirstEvent>())
.When(c => c
.Command<DomainErrorAfterFirstCommand>())
.Then(c => c
.Event<PingEvent>(e => true));
Here is an example of one I am working on using LightBDD as a comparison.
[FeatureDescription(
@"To use the system
As a potential user
I want to register")]
// ReSharper disable once InconsistentNaming
public partial class Register_For_Account
: EventFlowBehaviourTest<MembershipTestConfiguration>
{
[Test]
public void Successful_Registration()
{
var person = People.BobJones;
Runner.RunScenario
(
given => Prosective_user_has_not_registration(person),
when => Prosective_user_submits_a_valid_registration(person),
when => Prospective_user_confirms_the_registration(person),
then => Account_exists_for_the_user(person),
then => Login_exists_for_the_user(person),
then => Login_is_linked_to_the_user_account(person)
);
}
}
And an elided section of implementations
public partial class Register_For_Account
{
...
public void Prosective_user_submits_a_valid_registration(IPerson person)
{
try
{
SystemClock.Set(DateTime.Now.AddMinutes(-5));
CommandBus.SubmitRegistrationAsync
(
person.EmailAddress,
person.FirstName,
person.LastName,
person.Password,
CancellationToken.None
).Wait();
}
finally
{
SystemClock.Reset();
}
}
public void Prospective_user_confirms_the_registration(IPerson person)
{
var confirmationCode = this.GetRegistrationConfirmationCode(person.RegistrationId);
CommandBus.ConfirmRegistrationAsync
(
person.RegistrationId,
person.EmailAddress,
confirmationCode,
CancellationToken.None
).Wait();
}
}
from eventflow.
Hello there!
We hope you are doing well. We noticed that this issue has not seen any activity in the past 90 days.
We consider this issue to be stale and will be closing it within the next seven days.
If you still require assistance with this issue, please feel free to reopen it or create a new issue.
Thank you for your understanding and cooperation.
Best regards,
EventFlow
from eventflow.
Hello there!
This issue has been closed due to inactivity for seven days. If you believe this issue still
needs attention, please feel free to open a new issue or comment on this one to request its
reopening.
Thank you for your contribution to this repository.
Best regards,
EventFlow
from eventflow.
Related Issues (20)
- ReadModelSqlGenerator Column Prefix and Suffix - Not Used in Select Query HOT 1
- How sagas can be interconnected through service bus or rabbitmq , on specific events HOT 2
- RobiniaDocs API Explorer HOT 2
- Issues with IReadModelLocator and ReadModelDescriptionprovider HOT 1
- ISnapshotSerilizer and SnapshotSerilizer spelling not correct HOT 2
- IEventUpgrader.Upgrade must be async HOT 3
- Command throws ArgumentNullException with the wrong parameter name
- Finish migration of 1.0 documentation to mkdocs HOT 2
- CommandHandler can never fail bug (v0 & v1) HOT 10
- AggregateRoot.Emit() does not check for duplicate SourceId HOT 3
- SnapshotAggregateRoot does not throw DuplicateOperationException when execute the same comamnd executed before save snapshot HOT 3
- Getting correct aggregate state in subscriber HOT 3
- Configurable MongoDB Query BatchSize HOT 3
- An error occurs when net6.0 uses UseFilesEventPersistence HOT 1
- EntityFramework Dictionary Updates HOT 3
- [Question] Paid development work for EventFlow HOT 6
- A way to configure JsonSerializerSettings at JsonSerializer HOT 3
- Help requested: Bring life to v0 HOT 2
- Elastic Search GeoPoint not being mapped properly in index HOT 2
- Event rollback during Saga failure? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eventflow.