public void Accepting_the_changes_should_clear_the_uncommitted_events() { var theAggregate = new MyAggregateRoot(); theAggregate.MethodThatCausesAnEventThatHasAHandler(); theAggregate.MethodThatCausesAnEventThatHasAHandler(); theAggregate.MethodThatCausesAnEventThatHasAHandler(); theAggregate.MethodThatCausesAnEventThatHasAHandler(); theAggregate.MethodThatCausesAnEventThatHasAHandler(); theAggregate.AcceptChanges(); theAggregate.GetUncommittedEvents().Should().BeEmpty(); }
public void Accepting_the_changes_should_set_the_initial_version_to_the_new_version() { var theAggregate = new MyAggregateRoot(); theAggregate.MethodThatCausesAnEventThatHasAHandler(); theAggregate.MethodThatCausesAnEventThatHasAHandler(); theAggregate.MethodThatCausesAnEventThatHasAHandler(); theAggregate.MethodThatCausesAnEventThatHasAHandler(); theAggregate.MethodThatCausesAnEventThatHasAHandler(); theAggregate.InitialVersion.Should().Be(0); theAggregate.AcceptChanges(); theAggregate.InitialVersion.Should().Be(5); }
public void Accepting_the_changes_should_clear_the_uncommitted_events() { using (NcqrsEnvironment.Get<IUnitOfWorkFactory>().CreateUnitOfWork()) { var theAggregate = new MyAggregateRoot(); theAggregate.MethodThatCausesAnEventThatHasAHandler(); theAggregate.MethodThatCausesAnEventThatHasAHandler(); theAggregate.MethodThatCausesAnEventThatHasAHandler(); theAggregate.MethodThatCausesAnEventThatHasAHandler(); theAggregate.MethodThatCausesAnEventThatHasAHandler(); theAggregate.AcceptChanges(); theAggregate.GetUncommittedEvents().Should().BeEmpty(); } }
public void Accepting_the_changes_should_set_the_initial_version_to_the_new_version() { using (NcqrsEnvironment.Get<IUnitOfWorkFactory>().CreateUnitOfWork()) { var theAggregate = new MyAggregateRoot(); theAggregate.MethodThatCausesAnEventThatHasAHandler(); theAggregate.MethodThatCausesAnEventThatHasAHandler(); theAggregate.MethodThatCausesAnEventThatHasAHandler(); theAggregate.MethodThatCausesAnEventThatHasAHandler(); theAggregate.MethodThatCausesAnEventThatHasAHandler(); theAggregate.InitialVersion.Should().Be(0); theAggregate.AcceptChanges(); theAggregate.InitialVersion.Should().Be(5); } }