예제 #1
0
            public async Task ShouldSaveAggregateRoot()
            {
                var aggregateRoot = new TestAggregateRoot(Guid.NewGuid());

                var repository = new InMemoryAggregateRootRepository <TestAggregateRoot>();
                await repository.SaveAsync(aggregateRoot);

                var result = await repository.GetByIdAsync(aggregateRoot.Id);

                result.Should().Be(aggregateRoot);
            }
예제 #2
0
            public async Task ShouldReplaceExistingAggregateRoots()
            {
                var aggregateRoot1 = new TestAggregateRoot(Guid.NewGuid());
                var aggregateRoot2 = new TestAggregateRoot(Guid.NewGuid());

                var repository = new InMemoryAggregateRootRepository <TestAggregateRoot>();
                await repository.SaveAsync(aggregateRoot1);

                await repository.SaveAsync(aggregateRoot2);

                var result = await repository.GetByIdAsync(aggregateRoot2.Id);

                result.Should().Be(aggregateRoot2);
            }