public void It_should_enforce_uniqueness_even_for_two_unique_properties() { var saga1 = new SagaWithTwoUniqueProperties() { Id = Guid.NewGuid(), UniqueString = "whatever", UniqueInt = 5}; var saga2 = new SagaWithTwoUniqueProperties { Id = Guid.NewGuid(), UniqueString = "whatever1", UniqueInt = 3}; var saga3 = new SagaWithTwoUniqueProperties { Id = Guid.NewGuid(), UniqueString = "whatever3", UniqueInt = 3 }; var inMemorySagaPersister = new InMemorySagaPersister() as ISagaPersister; inMemorySagaPersister.Save(saga1); inMemorySagaPersister.Save(saga2); Assert.Throws<InvalidOperationException>(() => inMemorySagaPersister.Save(saga3)); }
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_persist_successfully_for_two_unique_properties() { var saga1 = new SagaWithTwoUniqueProperties { Id = Guid.NewGuid(), UniqueString = "whatever1", UniqueInt = 5}; var saga2 = new SagaWithTwoUniqueProperties { Id = Guid.NewGuid(), UniqueString = "whatever", UniqueInt = 37}; var inMemorySagaPersister = new InMemorySagaPersister() as ISagaPersister; inMemorySagaPersister.Save(saga1); inMemorySagaPersister.Save(saga2); Assert.Throws<InvalidOperationException>(() => { var saga = inMemorySagaPersister.Get<SagaWithTwoUniqueProperties>(saga2.Id); saga.UniqueInt = 5; inMemorySagaPersister.Update(saga); }); }
public void It_should_enforce_uniqueness_even_for_two_unique_properties() { var saga1 = new SagaWithTwoUniqueProperties { Id = Guid.NewGuid(), UniqueString = "whatever", UniqueInt = 5 }; var saga2 = new SagaWithTwoUniqueProperties { Id = Guid.NewGuid(), UniqueString = "whatever1", UniqueInt = 3 }; var saga3 = new SagaWithTwoUniqueProperties { Id = Guid.NewGuid(), UniqueString = "whatever3", UniqueInt = 3 }; var inMemorySagaPersister = new InMemorySagaPersister() as ISagaPersister; inMemorySagaPersister.Save(saga1); inMemorySagaPersister.Save(saga2); Assert.Throws <InvalidOperationException>(() => inMemorySagaPersister.Save(saga3)); }
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_persist_successfully_for_two_unique_properties() { var saga1 = new SagaWithTwoUniqueProperties { Id = Guid.NewGuid(), UniqueString = "whatever1", UniqueInt = 5 }; var saga2 = new SagaWithTwoUniqueProperties { Id = Guid.NewGuid(), UniqueString = "whatever", UniqueInt = 37 }; var inMemorySagaPersister = new InMemorySagaPersister(); inMemorySagaPersister.Save(saga1); inMemorySagaPersister.Save(saga2); Assert.Throws <InvalidOperationException>(() => { var saga = inMemorySagaPersister.Get <SagaWithTwoUniqueProperties>(saga2.Id); saga.UniqueInt = 5; inMemorySagaPersister.Update(saga); }); }