public ThingyAddMessageCommand( ThingyId aggregateId, ThingyMessage thingyMessage) : base(aggregateId) { ThingyMessage = thingyMessage; }
public void AddMessage(ThingyMessage message) { if (_messages.Any(m => m.Id == message.Id)) { throw DomainError.With($"Thingy '{Id}' already has a message with ID '{message.Id}'"); } Emit(new ThingyMessageAddedEvent(message)); }
public ThingyAddMessageAndPingCommand( ThingyId aggregateId, ThingyMessage thingyMessage, PingId pingId, bool pingFirst) : base(aggregateId) { ThingyMessage = thingyMessage; PingId = pingId; PingFirst = pingFirst; }
public async Task EventsCanContainUnicodeCharacters() { // Arrange var id = ThingyId.New; var testAggregate = await LoadAggregateAsync(id).ConfigureAwait(false); var message = new ThingyMessage(ThingyMessageId.New, "😉"); testAggregate.AddMessage(message); await testAggregate.CommitAsync(EventStore, SnapshotStore, SourceId.New, CancellationToken.None).ConfigureAwait(false); // Act var loadedTestAggregate = await LoadAggregateAsync(id).ConfigureAwait(false); // Assert loadedTestAggregate.Messages.Single().Message.Should().Be("😉"); }
public ThingyMessageAddedEvent( ThingyMessage thingyMessage) { ThingyMessage = thingyMessage; }