public async Task LocateSagasAsync_FindsExistingSagaByKey()
        {
            sagaRegistry.LookupRegistrations(typeof(Event1))
            .Returns(new List <SagaEventRegistration>()
            {
                SagaEventRegistration.MatchedByKey(typeof(Saga1), typeof(Event1),
                                                   x => ((Event1)x).Foo.ToString(), "foo", false)
            });

            Guid sagaId1 = Guid.NewGuid();

            sagaMetadataRepository.FindSagasByKeyAsync(typeof(Saga1).GetClassId(), "foo", "5")
            .Returns(new [] { new SagaMatch()
                              {
                                  Id = sagaId1, ClassId = typeof(Saga1).GetClassId()
                              } });

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

            result.Should().BeEquivalentTo(new[]
            {
                LocatedSaga.FromId(sagaId1, typeof(Saga1))
            });
        }
        public async Task LocateSagasAsync_StartsSagaWhenNotFoundByKey()
        {
            sagaRegistry.LookupRegistrations(typeof(Event1))
            .Returns(new List <SagaEventRegistration>()
            {
                SagaEventRegistration.MatchedByKey(typeof(Saga1), typeof(Event1),
                                                   x => ((Event1)x).Foo.ToString(), "foo", true)
            });

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

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