예제 #1
0
        public async Task <IActionResult> GetAsync(string testAggregateIdValue)
        {
            var testAggregateId = TestAggregateId.With(testAggregateIdValue);
            var testAggregate   = await _queryProcessor.ProcessAsync(new ReadModelByIdQuery <TestReadModel>(testAggregateId), default);

            return(Ok(testAggregate));
        }
예제 #2
0
        public void Identity_Created_WithGuid()
        {
            var guid = Guid.NewGuid();

            var testId = TestAggregateId.With(guid);

            testId.GetGuid().Should().Be(guid);
        }
예제 #3
0
        public void Arguments(string aggregateId, int magicNumber, string expectedSouceId)
        {
            var testId  = TestAggregateId.With(aggregateId);
            var command = new MyDistinctCommand(testId, magicNumber);

            var sourceId = command.SourceId;

            sourceId.Value.Should().Be(expectedSouceId);
        }
예제 #4
0
        public void Identity_Valid_WithValue(string value, string expectedGuidValue)
        {
            TestAggregateId testId       = null;
            var             expectedGuid = Guid.Parse(expectedGuidValue);

            Action action = () => testId = TestAggregateId.With(value);

            action.Should().NotThrow();

            testId.Should().NotBeNull();
            testId.Value.Should().Be(value);
            testId.GetGuid().Should().Be(expectedGuid);
        }
예제 #5
0
        public void Identity_CannotCreate_WithBadIds(string badIdValue)
        {
            Action action = () => TestAggregateId.With(badIdValue);

            action.Should().Throw <ArgumentException>();
        }
예제 #6
0
 public void Hydrate(TestAsyncSagaSnapshot aggregateSnapshot)
 {
     Sender   = TestAggregateId.With(aggregateSnapshot.SenderId);
     Receiver = TestAggregateId.With(aggregateSnapshot.ReceiverId);
     Test     = new Entities.Test(TestId.With(aggregateSnapshot.Test.Id));
 }