public void UpdateSagaData(
            MongoSagaPersister sut,
            MongoDatabaseFactory factory,
            DeviceCommandSagaState state)
        {
            sut.Save(state);

            sut.Update(state);
        }
        public void UpdateSagaData(
            MongoSagaPersister sut,
            MongoDatabaseFactory factory,
            DeviceCommandSagaState state)
        {
            sut.Save(state);

            sut.Update(state);
        }
        public void UpdateSagaData(
            MongoSagaPersister sut,
            DeviceCommandSagaState state,
            SynchronizedStorageSession session,
            ContextBag context)
        {
            var correlationProperty = new SagaCorrelationProperty("SagaKey", state.SagaKey);

            sut.Save(state, correlationProperty, session, context).Wait();

            sut.Update(state, session, context).Wait();
        }
Exemple #4
0
        public void UpdateCollisionShouldFail(
            MongoSagaPersister sut,
            MongoDatabaseFactory factory,
            SagaWithUniqueProperty sagaData)
        {
            sut.Save(sagaData);
            var saga1 = factory.RetrieveSagaData(sagaData);
            var saga2 = factory.RetrieveSagaData(sagaData);

            saga1.UniqueProperty = Guid.NewGuid().ToString();
            sut.Update(saga1);

            saga2.UniqueProperty = Guid.NewGuid().ToString();
            sut.Invoking(s => s.Update(saga2)).ShouldThrow <InvalidOperationException>();
        }
Exemple #5
0
        public void UpdatingSagaWithUniqueProperty(
            MongoSagaPersister sut,
            MongoDatabaseFactory factory,
            SagaWithUniqueProperty sagaData,
            string newValue)
        {
            sut.Save(sagaData);

            sagaData.NonUniqueProperty = newValue;
            sut.Update(sagaData);

            var entity = factory.RetrieveSagaData(sagaData);

            entity.NonUniqueProperty.Should().Be(newValue);
        }
        public void UpdatingSagaWithNoChangesShouldNotUpdateVersion(
            MongoSagaPersister sut,
            MongoDatabaseFactory factory,
            SagaWithUniqueProperty sagaData,
            SagaCorrelationProperty correlationProperty,
            SynchronizedStorageSession session,
            ContextBag context)
        {
            sut.Save(sagaData, correlationProperty, session, context).Wait();
            var saga1 = factory.RetrieveSagaData(sagaData);

            sut.Update(saga1, session, context).Wait();

            var saga2 = factory.RetrieveSagaData(sagaData);

            saga2.DocumentVersion.Should().Be(saga1.DocumentVersion);
        }
        public void UpdateCollisionShouldFail(
            MongoSagaPersister sut,
            MongoDatabaseFactory factory,
            SagaWithUniqueProperty sagaData,
            SagaCorrelationProperty correlationProperty,
            SynchronizedStorageSession session,
            ContextBag context)
        {
            sut.Save(sagaData, correlationProperty, session, context).Wait();
            var saga1 = factory.RetrieveSagaData(sagaData);
            var saga2 = factory.RetrieveSagaData(sagaData);

            saga1.UniqueProperty = Guid.NewGuid().ToString();
            sut.Update(saga1, session, context).Wait();

            saga2.UniqueProperty = Guid.NewGuid().ToString();
            sut.Invoking(s => s.Update(saga2, session, context).Wait()).ShouldThrow <InvalidOperationException>();
        }
        public void UpdatingSagaWithUniqueProperty(
            MongoSagaPersister sut,
            MongoDatabaseFactory factory,
            SagaWithUniqueProperty sagaData,
            string newValue,
            SagaCorrelationProperty correlationProperty,
            SynchronizedStorageSession session,
            ContextBag context)
        {
            sut.Save(sagaData, correlationProperty, session, context).Wait();

            sagaData.SomeValue = newValue;
            sut.Update(sagaData, session, context).Wait();

            var entity = factory.RetrieveSagaData(sagaData);

            entity.SomeValue.Should().Be(newValue);
        }
        public void UpdateCollisionShouldFail(
            MongoSagaPersister sut,
            MongoDatabaseFactory factory,
            SagaWithUniqueProperty sagaData)
        {
            sut.Save(sagaData);
            var saga1 = factory.RetrieveSagaData(sagaData);
            var saga2 = factory.RetrieveSagaData(sagaData);

            saga1.UniqueProperty = Guid.NewGuid().ToString();
            sut.Update(saga1);

            saga2.UniqueProperty = Guid.NewGuid().ToString();
            sut.Invoking(s => s.Update(saga2)).ShouldThrow<InvalidOperationException>();
        }
        public void UpdatingSagaWithUniqueProperty(
            MongoSagaPersister sut,
            MongoDatabaseFactory factory,
            SagaWithUniqueProperty sagaData,
            string newValue)
        {
            sut.Save(sagaData);

            sagaData.NonUniqueProperty = newValue;
            sut.Update(sagaData);

            var entity = factory.RetrieveSagaData(sagaData);
            entity.NonUniqueProperty.Should().Be(newValue);
        }