public void TestReadIsThreadSafe() { var items = new PersistedString[100]; try { for (var count = 0; count < items.Length; count++) { items[count] = new PersistedString { Content = Guid.NewGuid().ToString() }; } PersistanceStore.Save <PersistedString>(items); Parallel.ForEach(items, item => { PersistanceStore.GetAll <PersistedString>(); }); } finally { for (var count = 0; count < items.Length; count++) { PersistanceStore.Delete <PersistedString>(items[count].Id); } } }
public void UpdateToLiveObjectShouldNotAffectPersisted() { var idGenerator = new GuidIdGenerator(); var testObject1 = new TestObject(idGenerator.GenerateId(), "Name1"); PersistanceStore.Save(testObject1); testObject1.Name = "New Name"; var testObject2 = PersistanceStore.Get <TestObject>(testObject1.Id); testObject2.Should().NotBe(testObject1); }