PageRenderTime 26ms CodeModel.GetById 20ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

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