public async Task TestDomainEventsAreRegistered() { //Arrange var aggregate = ServiceLocator.Current.GetInstance <EventAggregate>(); var module = ServiceLocator.Current.GetInstance <IExtractEventMetadataService>(); var command = await module.ExtractEventMetadata(new DateTime(2015, 7, 14)); using (var scope = TransactionHelpers.GetTransactionScope()) { //Act aggregate.ImportEvent(command); var successEvent = aggregate.DomainEvents.FirstOrDefault(); //Assert Assert.IsNotNull(successEvent); Assert.IsTrue(successEvent is EventImported); var importedEvent = successEvent as EventImported; Assert.AreEqual(26, importedEvent.DealIds.Count()); Assert.AreEqual(26, importedEvent.PairIds.Count()); scope.Dispose(); } }