public void WhenCommandIsIssuedThenPendingEventIsCreated() { var aggregate = new TestAggregate(); Assert.Equal(0, aggregate.GetPendingEvents().Count); aggregate.ChangeName("New Name"); Assert.Equal(1, aggregate.GetPendingEvents().Count); }
public async void WhenAggregateIsSavedThenPendingEventsAreClearedFromAggregate() { var aggregate = new TestAggregate(); aggregate.ChangeName("New Name"); var connection = A.Fake <IEventStoreConnection>(); var repository = new Repository(connection, new EventTypeResolver(ReflectionHelper.ContractsAssembly)); await repository.SaveAsync(aggregate); Assert.Equal(0, aggregate.GetPendingEvents().Count); }