public void It_should_enforce_uniqueness()
        {
            var saga1 = new SagaWithUniqueProperty { Id = Guid.NewGuid(), UniqueString = "whatever"};
            var saga2 = new SagaWithUniqueProperty { Id = Guid.NewGuid(), UniqueString = "whatever"};
            var inMemorySagaPersister = new InMemorySagaPersister() as ISagaPersister;

            inMemorySagaPersister.Save(saga1);
            Assert.Throws<InvalidOperationException>(() => inMemorySagaPersister.Save(saga2));
        }
        public void Should_delete_the_saga()
        {
            var inMemorySagaPersister = new InMemorySagaPersister();
            var saga = new SagaWithUniqueProperty { Id = Guid.NewGuid(), UniqueString = "whatever" };

            inMemorySagaPersister.Save(saga);
            Assert.NotNull(inMemorySagaPersister.Get<SagaWithUniqueProperty>(saga.Id));
            inMemorySagaPersister.Complete(saga);
            Assert.Null(inMemorySagaPersister.Get<SagaWithUniqueProperty>(saga.Id));
        }
Пример #3
0
        public void Should_delete_the_saga()
        {
            var inMemorySagaPersister = new InMemorySagaPersister();
            var saga = new SagaWithUniqueProperty {
                Id = Guid.NewGuid(), UniqueString = "whatever"
            };

            inMemorySagaPersister.Save(saga);
            Assert.NotNull(inMemorySagaPersister.Get <SagaWithUniqueProperty>(saga.Id));
            inMemorySagaPersister.Complete(saga);
            Assert.Null(inMemorySagaPersister.Get <SagaWithUniqueProperty>(saga.Id));
        }
        public void It_should_persist_successfully()
        {
            var saga1 = new SagaWithTwoUniqueProperties { Id = Guid.NewGuid(), UniqueString = "whatever", UniqueInt = 5 };
            var saga2 = new AnotherSagaWithTwoUniqueProperties { Id = Guid.NewGuid(), UniqueString = "whatever", UniqueInt = 5 };
            var saga3 = new SagaWithUniqueProperty {Id = Guid.NewGuid(), UniqueString = "whatever"};

            var inMemorySagaPersister = new InMemorySagaPersister() as ISagaPersister;

            inMemorySagaPersister.Save(saga1);
            inMemorySagaPersister.Save(saga2);
            inMemorySagaPersister.Save(saga3);
        }
        public void It_should_enforce_uniqueness()
        {
            var saga1 = new SagaWithUniqueProperty {
                Id = Guid.NewGuid(), UniqueString = "whatever"
            };
            var saga2 = new SagaWithUniqueProperty {
                Id = Guid.NewGuid(), UniqueString = "whatever"
            };
            var inMemorySagaPersister = new InMemorySagaPersister() as ISagaPersister;

            inMemorySagaPersister.Save(saga1);
            Assert.Throws <InvalidOperationException>(() => inMemorySagaPersister.Save(saga2));
        }
        public void It_should_persist_successfully()
        {
            var saga1 = new SagaWithUniqueProperty{Id = Guid.NewGuid(), UniqueString = "whatever"};
            var saga2 = new SagaWithUniqueProperty{Id = Guid.NewGuid(), UniqueString = "whatever"};
            var inMemorySagaPersister = new InMemorySagaPersister();
            
            inMemorySagaPersister.Save(saga1);
            saga1 = inMemorySagaPersister.Get<SagaWithUniqueProperty>(saga1.Id);
            saga1.UniqueString = "whatever2";
            inMemorySagaPersister.Update(saga1);

            inMemorySagaPersister.Save(saga2);
        }
        public void It_should_persist_successfully()
        {
            var saga1 = new SagaWithUniqueProperty { Id = Guid.NewGuid(), UniqueString = "whatever" };
            var saga2 = new SagaWithUniqueProperty { Id = Guid.NewGuid(), UniqueString = "whatever" };

             var inMemorySagaPersister = new InMemorySagaPersister() as ISagaPersister;

            inMemorySagaPersister.Save(saga1);
            inMemorySagaPersister.Complete(saga1);
            inMemorySagaPersister.Save(saga2);
            inMemorySagaPersister.Complete(saga2);
            inMemorySagaPersister.Save(saga1);
            inMemorySagaPersister.Complete(saga1);
        }
        public void It_should_persist_successfully()
        {
            var saga1 = new SagaWithUniqueProperty
            {
                Id           = Guid.NewGuid(),
                UniqueString = "whatever"
            };

            var inMemorySagaPersister = new InMemorySagaPersister();

            inMemorySagaPersister.Save(saga1);
            saga1 = inMemorySagaPersister.Get <SagaWithUniqueProperty>(saga1.Id);
            inMemorySagaPersister.Update(saga1);
        }
        public void It_should_persist_successfully()
        {
            var saga1 = new SagaWithUniqueProperty {Id = Guid.NewGuid(), UniqueString = "whatever1"};
            var saga2 = new SagaWithUniqueProperty {Id = Guid.NewGuid(), UniqueString = "whatever"};
            var inMemorySagaPersister = new InMemorySagaPersister();
            
            inMemorySagaPersister.Save(saga1);
            inMemorySagaPersister.Save(saga2);

            Assert.Throws<InvalidOperationException>(() => 
            {
                var saga = inMemorySagaPersister.Get<SagaWithUniqueProperty>(saga2.Id);
                saga.UniqueString = "whatever1";
                inMemorySagaPersister.Update(saga);
            });
        }
        public void  It_should_persist_successfully()
        {
            var saga1 = new SagaWithTwoUniqueProperties {
                Id = Guid.NewGuid(), UniqueString = "whatever", UniqueInt = 5
            };
            var saga2 = new AnotherSagaWithTwoUniqueProperties {
                Id = Guid.NewGuid(), UniqueString = "whatever", UniqueInt = 5
            };
            var saga3 = new SagaWithUniqueProperty {
                Id = Guid.NewGuid(), UniqueString = "whatever"
            };

            var inMemorySagaPersister = new InMemorySagaPersister() as ISagaPersister;

            inMemorySagaPersister.Save(saga1);
            inMemorySagaPersister.Save(saga2);
            inMemorySagaPersister.Save(saga3);
        }
Пример #11
0
        public void It_should_persist_successfully()
        {
            var saga1 = new SagaWithUniqueProperty {
                Id = Guid.NewGuid(), UniqueString = "whatever"
            };
            var saga2 = new SagaWithUniqueProperty {
                Id = Guid.NewGuid(), UniqueString = "whatever"
            };

            var inMemorySagaPersister = new InMemorySagaPersister() as ISagaPersister;

            inMemorySagaPersister.Save(saga1);
            inMemorySagaPersister.Complete(saga1);
            inMemorySagaPersister.Save(saga2);
            inMemorySagaPersister.Complete(saga2);
            inMemorySagaPersister.Save(saga1);
            inMemorySagaPersister.Complete(saga1);
        }
        public void It_should_persist_successfully()
        {
            var saga1 = new SagaWithUniqueProperty {
                Id = Guid.NewGuid(), UniqueString = "whatever1"
            };
            var saga2 = new SagaWithUniqueProperty {
                Id = Guid.NewGuid(), UniqueString = "whatever"
            };
            var inMemorySagaPersister = new InMemorySagaPersister();

            inMemorySagaPersister.Save(saga1);
            inMemorySagaPersister.Save(saga2);

            Assert.Throws <InvalidOperationException>(() =>
            {
                var saga          = inMemorySagaPersister.Get <SagaWithUniqueProperty>(saga2.Id);
                saga.UniqueString = "whatever1";
                inMemorySagaPersister.Update(saga);
            });
        }