Пример #1
0
 public static void should_be_the_same_committed_event(this CommittedEvent actual, CommittedEvent expected)
 {
     JToken.DeepEquals(JToken.Parse(actual.Content), JToken.Parse(expected.Content)).ShouldBeTrue();
     actual.Occurred.UtcDateTime.ShouldBeCloseTo(expected.Occurred.UtcDateTime, TimeSpan.FromMilliseconds(1));
     actual.Public.ShouldEqual(expected.Public);
     actual.EventSource.Value.ShouldEqual(expected.EventSource.Value);
     actual.Type.Generation.Value.ShouldEqual(expected.Type.Generation.Value);
     actual.Type.Id.Value.ShouldEqual(expected.Type.Id.Value);
     actual.ExecutionContext.ShouldEqual(expected.ExecutionContext);
     actual.EventLogSequenceNumber.Value.ShouldEqual(expected.EventLogSequenceNumber.Value);
 }
Пример #2
0
 static void should_be_the_same_base_committed_event(IEventContentConverter event_content_converter, CommittedEvent committed_event, Event stored_event)
 {
     JToken.DeepEquals(JToken.Parse(event_content_converter.ToJson(stored_event.Content)), JToken.Parse(committed_event.Content)).ShouldBeTrue();
     stored_event.Metadata.Occurred.ShouldBeCloseTo(committed_event.Occurred.UtcDateTime, TimeSpan.FromSeconds(1));
     stored_event.Metadata.Public.ShouldEqual(committed_event.Public);
     stored_event.Metadata.EventSource.ShouldEqual(committed_event.EventSource.Value);
     stored_event.Metadata.TypeGeneration.ShouldEqual(committed_event.Type.Generation.Value);
     stored_event.Metadata.TypeId.ShouldEqual(committed_event.Type.Id.Value);
     should_have_same_execution_context(committed_event.ExecutionContext, stored_event.ExecutionContext);
     stored_event.EventLogSequenceNumber.ShouldEqual(committed_event.EventLogSequenceNumber.Value);
 }
Пример #3
0
 /// <summary>
 /// Convert to a protobuf message representation of <see cref="CommittedEvent"/>.
 /// </summary>
 /// <param name="event"><see cref="CommittedEvent"/> to convert from.</param>
 /// <returns>Converted <see cref="Contracts.CommittedEvent"/>.</returns>
 public static Contracts.CommittedEvent ToProtobuf(this CommittedEvent @event) =>
 @event is CommittedExternalEvent externalEvent?