public static void ShouldBeTheSameAs(this CommittedExternalEvent committedEvent, MongoDB.Events.Event storedEvent) { (committedEvent as CommittedEvent).ShouldBeTheSameAs(storedEvent); committedEvent.ExternalEventLogSequenceNumber.Value.ShouldEqual(storedEvent.EventHorizon.ExternalEventLogSequenceNumber); committedEvent.Received.UtcDateTime.ShouldEqual(storedEvent.EventHorizon.Received); committedEvent.Consent.Value.ShouldEqual(storedEvent.EventHorizon.Consent); }
/// <inheritdoc/> public mongoDB.Event ToEventLogEvent(CommittedExternalEvent committedEvent) => new mongoDB.Event( committedEvent.EventLogSequenceNumber, committedEvent.ExecutionContext.ToStoreRepresentation(), committedEvent.GetEventMetadata(), new AggregateMetadata(), committedEvent.GetEventHorizonMetadata(), BsonDocument.Parse(committedEvent.Content));
/// <summary> /// Derives the <see cref="ExternalEventContext"/> for a <see cref="CommittedExternalEvent"/>. /// </summary> /// <param name="committedEvent">The <see cref="CommittedExternalEvent"/>.</param> /// <returns>The derived <see cref="ExternalEventContext"/>.</returns> public static ExternalEventContext DeriveContext(this CommittedExternalEvent committedEvent) => new ExternalEventContext( committedEvent.EventLogSequenceNumber, committedEvent.EventSource, committedEvent.Occurred, committedEvent.ExecutionContext, committedEvent.ExternalEventLogSequenceNumber, committedEvent.Received);
/// <summary> /// Convert to a protobuf message representation of <see cref="CommittedExternalEvent"/>. /// </summary> /// <param name="event"><see cref="CommittedExternalEvent"/> to convert from.</param> /// <returns>Converted <see cref="Contracts.CommittedEvent"/>.</returns> public static Contracts.CommittedEvent ToProtobuf(this CommittedExternalEvent @event) => new()
/// <summary> /// Gets the <see cref="EventHorizonMetadata"/> from the <see cref="CommittedExternalEvent"/>. /// </summary> /// <param name="committedEvent">The <see cref="CommittedExternalEvent"/>.</param> /// <returns>The converted <see cref="EventHorizonMetadata" />.</returns> public static EventHorizonMetadata GetEventHorizonMetadata(this CommittedExternalEvent committedEvent) => new EventHorizonMetadata( committedEvent.ExternalEventLogSequenceNumber, committedEvent.Received.UtcDateTime, committedEvent.Consent);
/// <inheritdoc/> public mongoDB.Event ToEventLogEvent(CommittedExternalEvent committedEvent) =>