public void It_should_enforce_uniqueness_even_for_two_unique_properties()
        {
            var saga1 = new SagaWithTwoUniquePropertiesData {
                Id = Guid.NewGuid(), UniqueString = "whatever", UniqueInt = 5
            };
            var saga2 = new SagaWithTwoUniquePropertiesData {
                Id = Guid.NewGuid(), UniqueString = "whatever1", UniqueInt = 3
            };
            var saga3 = new SagaWithTwoUniquePropertiesData {
                Id = Guid.NewGuid(), UniqueString = "whatever3", UniqueInt = 3
            };

            persister.Save(saga1);
            persister.Save(saga2);
            Assert.Throws <InvalidOperationException>(() => persister.Save(saga3));
        }
        public void  It_should_persist_successfully()
        {
            var saga1 = new SagaWithTwoUniquePropertiesData {
                Id = Guid.NewGuid(), UniqueString = "whatever", UniqueInt = 5
            };
            var saga2 = new AnotherSagaWithTwoUniquePropertiesData {
                Id = Guid.NewGuid(), UniqueString = "whatever", UniqueInt = 5
            };
            var saga3 = new SagaWithUniquePropertyData {
                Id = Guid.NewGuid(), UniqueString = "whatever"
            };



            persister.Save(saga1);
            persister.Save(saga2);
            persister.Save(saga3);
        }
Exemple #3
0
        public void It_should_persist_successfully_for_two_unique_properties()
        {
            var saga1 = new SagaWithTwoUniquePropertiesData {
                Id = Guid.NewGuid(), UniqueString = "whatever1", UniqueInt = 5
            };
            var saga2 = new SagaWithTwoUniquePropertiesData {
                Id = Guid.NewGuid(), UniqueString = "whatever", UniqueInt = 37
            };

            persister.Save(saga1);
            persister.Save(saga2);

            Assert.Throws <InvalidOperationException>(() =>
            {
                var saga       = persister.Get <SagaWithTwoUniquePropertiesData>(saga2.Id);
                saga.UniqueInt = 5;
                persister.Update(saga);
            });
        }