public override byte[] ToBytes() { return(TLUtils.Combine( TLUtils.SignatureToBytes(Signature), PingId.ToBytes(), DisconnectDelay.ToBytes())); }
public async Task PublishingStartAndCompleteWithPingsResultInCorrectMessages() { // Arrange var thingyId = A <ThingyId>(); // Act var pingsWithNewSaga = await PublishPingCommandsAsync(thingyId, 3).ConfigureAwait(false); await CommandBus.PublishAsync(new ThingyRequestSagaStartCommand(thingyId), CancellationToken.None).ConfigureAwait(false); var pingsWithRunningSaga = await PublishPingCommandsAsync(thingyId, 3).ConfigureAwait(false); await CommandBus.PublishAsync(new ThingyRequestSagaCompleteCommand(thingyId), CancellationToken.None).ConfigureAwait(false); var pingsWithCompletedSaga = await PublishPingCommandsAsync(thingyId, 3).ConfigureAwait(false); // Assert - saga var thingySaga = await LoadSagaAsync(thingyId).ConfigureAwait(false); thingySaga.State.Should().Be(SagaState.Completed); thingySaga.PingIdsSinceStarted.ShouldAllBeEquivalentTo(pingsWithRunningSaga); // Assert - aggregate var thingyAggregate = await LoadAggregateAsync(thingyId).ConfigureAwait(false); thingyAggregate.PingsReceived.ShouldAllBeEquivalentTo( pingsWithNewSaga.Concat(pingsWithRunningSaga).Concat(pingsWithCompletedSaga)); var receivedSagaPingIds = thingyAggregate.Messages .Select(m => PingId.With(m.Message)) .ToList(); receivedSagaPingIds.Should().HaveCount(3); receivedSagaPingIds.ShouldAllBeEquivalentTo(pingsWithRunningSaga); }
public IExecutionResult PingMaybe(PingId pingId, bool isSuccess) { Emit(new ThingyPingEvent(pingId)); return(isSuccess ? ExecutionResult.Success() : ExecutionResult.Failed()); }
public void ValidateTestAggregate() { // Act var testAggregate = _eventStore.LoadAggregate <ThingyAggregate, ThingyId>(_thingyId, CancellationToken.None); // Assert testAggregate.Version.Should().Be(2); testAggregate.PingsReceived.Should().Contain(PingId.With("95433aa0-11f7-4128-bd5f-18e0ecc4d7c1")); testAggregate.PingsReceived.Should().Contain(PingId.With("2352d09b-4712-48cc-bb4f-5560d7c52558")); }
public ThingyAddMessageAndPingCommand( ThingyId aggregateId, ThingyMessage thingyMessage, PingId pingId, bool pingFirst) : base(aggregateId) { ThingyMessage = thingyMessage; PingId = pingId; PingFirst = pingFirst; }
public ThingyPingCommand(ThingyId aggregateId, SourceId sourceId, PingId pingId) : base(aggregateId, sourceId) { PingId = pingId; }
public ThingyPingCommand(ThingyId aggregateId, PingId pingId) : this(aggregateId, CommandId.New, pingId) { }
public PingCommand(TestId aggregateId, SourceId sourceId, PingId pingId) : base(aggregateId, sourceId) { PingId = pingId; }
public PingCommand(TestId aggregateId, PingId pingId) : this(aggregateId, CommandId.New, pingId) { }
public ThingySagaPingReceivedEvent( PingId pingId) { PingId = pingId; }
public PingCommand(TestId id, PingId pingId) : base(id) { PingId = pingId; }
public ThingyPingEvent(PingId pingId) { PingId = pingId; }
public void Apply(IReadModelContext context, IDomainEvent <TestAggregate, TestId, PingEvent> domainEvent) { Id = domainEvent.AggregateEvent.PingId; }
public void Ping(PingId pingId) { Emit(new ThingyPingEvent(pingId)); }
public void Apply(IReadModelContext context, IDomainEvent <ThingyAggregate, ThingyId, ThingyPingEvent> domainEvent) { Id = domainEvent.AggregateEvent.PingId; }
public ThingyMaybePingCommand(ThingyId aggregateId, PingId pingId, bool isSuccess) : base(aggregateId, CommandId.New) { PingId = pingId; IsSuccess = isSuccess; }
public PingEvent(PingId pingId) { PingId = pingId; }