Ejemplo n.º 1
0
        public async Task LockAsync_should_allow_different_saga_state_types_to_share_the_correlation_id()
        {
            var sut = CreateSut();

            var correlationId = Guid.NewGuid();

            var newState = new DummyState(correlationId, "lorem", 42);

            var(state, lockId) = await sut.LockAsync(correlationId, newState, CancellationToken.None);

            var newState2 = new DummyState2(state.Id);

            newState2.Id.Should().Be(newState.Id);

            var(state2, lockId2) = await sut.LockAsync(correlationId, newState2, CancellationToken.None);

            state2.Should().NotBeNull();
            state2.Id.Should().Be(correlationId);
        }
Ejemplo n.º 2
0
        public async Task LockAsync_should_allow_different_saga_state_types_to_share_the_correlation_id()
        {
            var serializer = new JsonSerializer();

            var options = new MongoSagaStateRepositoryOptions(TimeSpan.FromMinutes(1));
            var sut     = new MongoSagaStateRepository(_fixture.DbContext, serializer, options);

            var newState = DummyState.New();

            var(state, lockId) = await sut.LockAsync(newState.Id, newState, CancellationToken.None);

            var newState2 = new DummyState2(state.Id);

            newState2.Id.Should().Be(newState.Id);

            var(state2, lockId2) = await sut.LockAsync(newState2.Id, newState2, CancellationToken.None);

            state2.Should().NotBeNull();
            state2.Id.Should().Be(newState.Id);
        }