public void find_by() { var persistor = new InMemoryPersistor(); persistor.Persist(new User()); persistor.Persist(new User { FirstName = "Jeremy" }); persistor.Persist(new User()); persistor.FindBy <User>(x => x.FirstName == "Jeremy").FirstName.ShouldBe("Jeremy"); }
public void find_by() { var persistor = new InMemoryPersistor(); persistor.Persist(new User()); persistor.Persist(new User { FirstName = "Jeremy" }); persistor.Persist(new User()); persistor.FindBy<User>(x => x.FirstName == "Jeremy").FirstName.ShouldEqual("Jeremy"); }
public void remove() { var persistor = new InMemoryPersistor(); persistor.Persist(new User()); var user1 = new User(); persistor.Persist(user1); persistor.Persist(new User()); persistor.Remove(user1); persistor.LoadAll<User>().Count().ShouldEqual(2); persistor.LoadAll<User>().ShouldNotContain(user1); }
public void remove() { var persistor = new InMemoryPersistor(); persistor.Persist(new User()); var user1 = new User(); persistor.Persist(user1); persistor.Persist(new User()); persistor.Remove(user1); persistor.LoadAll <User>().Count().ShouldBe(2); persistor.LoadAll <User>().ShouldNotContain(user1); }
public void persist() { var entity = new OtherEntity(); var persistor = new InMemoryPersistor(); persistor.Persist(entity); persistor.LoadAll <OtherEntity>().Single().ShouldBeTheSameAs(entity); }
public void persist() { var entity = new OtherEntity(); var persistor = new InMemoryPersistor(); persistor.Persist(entity); persistor.LoadAll<OtherEntity>().Single().ShouldBeTheSameAs(entity); }
public void load_all() { var persistor = new InMemoryPersistor(); persistor.Persist(new User()); persistor.Persist(new User()); persistor.Persist(new User()); persistor.Persist(new OtherEntity()); persistor.Persist(new OtherEntity()); persistor.Persist(new ThirdEntity()); persistor.LoadAll <User>().Count().ShouldBe(3); persistor.LoadAll <OtherEntity>().Count().ShouldBe(2); persistor.LoadAll <ThirdEntity>().Count().ShouldBe(1); }
public void load_all() { var persistor = new InMemoryPersistor(); persistor.Persist(new User()); persistor.Persist(new User()); persistor.Persist(new User()); persistor.Persist(new OtherEntity()); persistor.Persist(new OtherEntity()); persistor.Persist(new ThirdEntity()); persistor.LoadAll<User>().Count().ShouldEqual(3); persistor.LoadAll<OtherEntity>().Count().ShouldEqual(2); persistor.LoadAll<ThirdEntity>().Count().ShouldEqual(1); }
public void delete_all() { var persistor = new InMemoryPersistor(); persistor.Persist(new User()); persistor.Persist(new User()); persistor.Persist(new User()); persistor.Persist(new OtherEntity()); persistor.Persist(new OtherEntity()); persistor.Persist(new ThirdEntity()); persistor.DeleteAll <ThirdEntity>(); persistor.LoadAll <User>().Count().ShouldEqual(3); persistor.LoadAll <OtherEntity>().Count().ShouldEqual(2); persistor.LoadAll <ThirdEntity>().Count().ShouldEqual(0); }
public void delete_all() { var persistor = new InMemoryPersistor(); persistor.Persist(new User()); persistor.Persist(new User()); persistor.Persist(new User()); persistor.Persist(new OtherEntity()); persistor.Persist(new OtherEntity()); persistor.Persist(new ThirdEntity()); persistor.DeleteAll<ThirdEntity>(); persistor.LoadAll<User>().Count().ShouldBe(3); persistor.LoadAll<OtherEntity>().Count().ShouldBe(2); persistor.LoadAll<ThirdEntity>().Count().ShouldBe(0); }
public void clear_all_state() { var persister = new InMemoryPersistor(); persister.Persist(new City()); persister.Persist(new City()); persister.Persist(new City()); persister.Persist(new City()); persister.Persist(new City()); persister.Persist(new City()); var reset = new InMemoryPersistenceReset(persister); persister.LoadAll<City>().Any().ShouldBeTrue(); reset.ClearPersistedState(); persister.LoadAll<City>().Any().ShouldBeFalse(); }
public void clear_all_state() { var persister = new InMemoryPersistor(); persister.Persist(new City()); persister.Persist(new City()); persister.Persist(new City()); persister.Persist(new City()); persister.Persist(new City()); persister.Persist(new City()); var reset = new InMemoryPersistenceReset(persister); persister.LoadAll <City>().Any().ShouldBeTrue(); reset.ClearPersistedState(); persister.LoadAll <City>().Any().ShouldBeFalse(); }
public void soft_deleted_entities_are_not_available_from_All() { var c1 = new SoftDeletedEntity(); var c2 = new SoftDeletedEntity { Deleted = new Milestone(DateTime.Now) }; var c3 = new SoftDeletedEntity(); var c4 = new SoftDeletedEntity { Deleted = new Milestone(DateTime.Now) }; thePersistor.Persist(c1); thePersistor.Persist(c2); thePersistor.Persist(c3); thePersistor.Persist(c4); thePersistor.Persist(c2); thePersistor.Persist(c4); ClassUnderTest.All().ShouldHaveTheSameElementsAs(c1, c3); }