コード例 #1
0
ファイル: ShouldExtensions.cs プロジェクト: dolittle/Runtime
 public static void ShouldBeTheSameAs(this CommittedAggregateEvent committedEvent, Events.Event storedEvent)
 {
     (committedEvent as CommittedEvent).ShouldBeTheSameAs(storedEvent);
     committedEvent.AggregateRoot.Id.Value.ShouldEqual(storedEvent.Aggregate.TypeId);
     committedEvent.AggregateRoot.Generation.Value.ShouldEqual(storedEvent.Aggregate.TypeGeneration);
     committedEvent.AggregateRootVersion.Value.ShouldEqual(storedEvent.Aggregate.Version);
 }
コード例 #2
0
 void ThrowIfAggreggateRootVersionIsOutOfOrder(CommittedAggregateEvent @event)
 {
     if (@event.AggregateRootVersion != Version)
     {
         throw new AggregateRootVersionIsOutOfOrder(@event.AggregateRootVersion, Version);
     }
 }
コード例 #3
0
 /// <summary>
 /// Convert to a protobuf message representation of <see cref="CommittedAggregateEvent"/>.
 /// </summary>
 /// <param name="event"><see cref="CommittedAggregateEvent"/> to convert from.</param>
 /// <returns>Converted <see cref="Contracts.CommittedAggregateEvents.Types.CommittedAggregateEvent"/>.</returns>
 public static Contracts.CommittedAggregateEvents.Types.CommittedAggregateEvent ToProtobuf(this CommittedAggregateEvent @event)
 {
     return(new Contracts.CommittedAggregateEvents.Types.CommittedAggregateEvent
     {
         EventLogSequenceNumber = @event.EventLogSequenceNumber,
         Occurred = Timestamp.FromDateTimeOffset(@event.Occurred),
         ExecutionContext = @event.ExecutionContext.ToProtobuf(),
         EventType = new ArtifactsContracts.Artifact
         {
             Id = @event.Type.Id.ToProtobuf(),
             Generation = @event.Type.Generation
         },
         Content = @event.Content,
         Public = @event.Public
     });
 }