예제 #1
0
        public void FixtureArrangerWithAggregateManager_CreatesAggregateManagerRef()
        {
            using (var testKit = new TestKit(_config, "fixture-tests-2"))
            {
                var fixture           = new AggregateFixture <TestAggregate, TestAggregateId>(testKit);
                var aggregateIdentity = TestAggregateId.New;

                fixture.Using(() => new TestAggregateManager(), aggregateIdentity);

                fixture.AggregateRef.Path.Name.Should().Be("aggregate-manager");
                fixture.AggregateId.Should().Be(aggregateIdentity);
            }
        }
예제 #2
0
        public void With_Test_Kit_TestEventMultipleEmitSourcing_AfterManyMultiCommand_TestStateSignalled()
        {
            var fixture     = new AggregateFixture <TestAggregate, TestAggregateId>(this);
            var aggregateId = TestAggregateId.New;

            fixture
            .Using(() => new TestAggregateManager(), aggregateId)
            .Given(new TestCreatedEvent(aggregateId))
            .When(new AddFourTestsCommand(aggregateId, new Test(TestId.New)))
            .AndWhen(new PoisonTestAggregateCommand(aggregateId))
            .AndWhen(new PublishTestStateCommand(aggregateId))
            .ThenExpectDomainEvent <TestStateSignalEvent>(
                x => x.AggregateEvent.LastSequenceNr == 5 &&
                x.AggregateEvent.Version == 5 &&
                x.AggregateEvent.AggregateState.TestCollection.Count == 4);
        }
예제 #3
0
        public void With_Test_Kit_TestEventSourcing_AfterManyTests_TestStateSignalled()
        {
            var fixture = new AggregateFixture <TestAggregate, TestAggregateId>(this);
            var aggregateId = TestAggregateId.New; var commands = new List <ICommand <TestAggregate, TestAggregateId> >();

            commands.AddRange(Enumerable.Range(0, 5).Select(x => new AddTestCommand(aggregateId, new Test(TestId.New))));

            fixture
            .Using(() => new TestAggregateManager(), aggregateId)
            .Given(new TestCreatedEvent(aggregateId))
            .When(commands.ToArray())
            .AndWhen(new PoisonTestAggregateCommand(aggregateId))
            .AndWhen(new PublishTestStateCommand(aggregateId))
            .ThenExpectDomainEvent <TestStateSignalEvent>(
                x => x.AggregateEvent.LastSequenceNr == 6 &&
                x.AggregateEvent.Version == 6 &&
                x.AggregateEvent.AggregateState.TestCollection.Count == 5);
        }
예제 #4
0
        public void FixtureArrangerWithAggregateManager_CreatesAggregateManagerRef()
        {
            using var testKit = new TestKit(Configuration.Default, "fixture-tests-2");
            testKit.Sys.RegisterDependencyResolver(
                new ServiceCollection()
                .AddEventFly(testKit.Sys)
                .WithContext <TestContext>()
                .Services
                .AddScoped <TestSaga>()
                .BuildServiceProvider()
                .UseEventFly()
                );

            var fixture           = new AggregateFixture <TestAggregate, TestAggregateId>(testKit);
            var aggregateIdentity = TestAggregateId.New;

            fixture.Using(aggregateIdentity);

            fixture.AggregateId.Should().Be(aggregateIdentity);
        }