예제 #1
0
        public void AddAndLookupRegistrations()
        {
            var s1e1 = SagaEventRegistration.AlwaysStarting(typeof(Saga1), typeof(Event1));
            var s1e2 = SagaEventRegistration.AlwaysStarting(typeof(Saga1), typeof(Event2));
            var s2e1 = SagaEventRegistration.AlwaysStarting(typeof(Saga2), typeof(Event1));

            sut.Add(s1e1);
            sut.Add(s1e2);
            sut.Add(s2e1);

            var registrations = sut.LookupRegistrations(typeof(Event1));

            registrations.Should().BeEquivalentTo(new[]
            {
                s1e1, s2e1
            });
        }
예제 #2
0
        public async Task LocateSagasAsync_AlwaysStarting_StartsSaga()
        {
            sagaRegistry.LookupRegistrations(typeof(Event1))
            .Returns(new List <SagaEventRegistration>()
            {
                SagaEventRegistration.AlwaysStarting(typeof(Saga1), typeof(Event1))
            });

            var result = await sut.LocateSagasAsync(
                new Event1()
            {
                Foo = 5
            }.ToMessageDraft());

            result.Should().BeEquivalentTo(new[]
            {
                LocatedSaga.CreateNew(typeof(Saga1))
            });
        }