예제 #1
0
 public ThingyAddMessageCommand(
     ThingyId aggregateId,
     ThingyMessage thingyMessage)
     : base(aggregateId)
 {
     ThingyMessage = thingyMessage;
 }
예제 #2
0
        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));
        }
예제 #3
0
 public ThingyAddMessageAndPingCommand(
     ThingyId aggregateId,
     ThingyMessage thingyMessage,
     PingId pingId,
     bool pingFirst)
     : base(aggregateId)
 {
     ThingyMessage = thingyMessage;
     PingId        = pingId;
     PingFirst     = pingFirst;
 }
예제 #4
0
        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;
 }