public void Exception_for_some_items_still_writes_the_others() { // the writer will fail on the batch and on the next 3 requests var writer = CreateWriter(writer: MockEventStore.ThrowsOnWrite(new Exception(), new[] { 1, 2, 3, 4 })); var requests = Enumerable.Range(0, 100).Select(_ => CreatePersistenceRequest(1)).ToList(); foreach (var r in requests) { writer.Tell(r); } var list = new List <object>(); for (var i = 0; i < requests.Count; i++) { var request = requests[i]; if (i <= 2) { ExpectMsg <PersistenceFailure>(msg => msg.PersistenceID == request.PersistenceID); } else { ExpectMsg <PersistenceSuccess>(msg => msg.PersistenceID == request.PersistenceID); } } }
public void DuplicatedEventException_causes_duplicatedevent_message() { var writer = CreateWriter(writer: MockEventStore.ThrowsOnWrite <DuplicatedEntryException>()); var request = CreatePersistenceRequest(); writer.Tell(request); ExpectMsg <DuplicatedEntry>(msg => msg.PersistenceID == request.PersistenceID, TimeSpan.FromMinutes(5)); }
public void UnexpectedStreamSequenceException_causes_unexpectedstreamsequence_message() { var writer = CreateWriter(writer: MockEventStore.ThrowsOnWrite <UnexpectedStreamSequenceException>()); var request = CreatePersistenceRequest(); writer.Tell(request); ExpectMsg <UnexpectedStreamSequence>(msg => msg.PersistenceID == request.PersistenceID); }
public void UnexpectedExceptions_during_write_causes_reply_with_persistencefailure(Type exceptionType) { var exception = Activator.CreateInstance(exceptionType) as Exception; var writer = CreateWriter(writer: MockEventStore.ThrowsOnWrite(exception)); var request = CreatePersistenceRequest(); writer.Tell(request); ExpectMsg <PersistenceFailure>(msg => msg.PersistenceID == request.PersistenceID && msg.Exception == exception); }