/Source/Bifrost.Specs/Events/for_EventStream/when_appending_an_event_to_a_committed_event_stream_out_of_sequence.cs

# · C# · 23 lines · 19 code · 4 blank · 0 comment · 0 complexity · b04a5b05a63236f7a61117c38bee7bfe MD5 · raw file

  1. using System;
  2. using System.Collections.Generic;
  3. using Bifrost.Events;
  4. using Bifrost.Fakes.Events;
  5. using Machine.Specifications;
  6. namespace Bifrost.Specs.Events.for_EventStream
  7. {
  8. public class when_appending_an_event_to_a_committed_event_stream_out_of_sequence : given.an_empty_committed_event_stream
  9. {
  10. static Exception Exception;
  11. Because of = () =>
  12. {
  13. var firstEvent = new SimpleEvent(EventSourceId) { Version = new EventSourceVersion(1, 0) };
  14. var eventOutOfSequence = new SimpleEvent(EventSourceId) { Version = new EventSourceVersion(1, 2) };
  15. Exception = Catch.Exception(() => EventStream.Append(new List<IEvent>() { firstEvent, eventOutOfSequence }));
  16. };
  17. It should_throw_an_event_out_of_sequence_exception = () => Exception.ShouldBeOfType<EventOutOfSequenceException>();
  18. }
  19. }