protected override void beforeEach()
        {
            LocalSystemTime = DateTime.Today.AddHours(8);


            thePersistor = new InMemoryPersistor();
            Services.Inject <IEntityStorage <SoftDeletedEntity> >(new EntityStorage <SoftDeletedEntity>(thePersistor));
        }
Ejemplo n.º 2
0
        public void persist()
        {
            var entity    = new OtherEntity();
            var persistor = new InMemoryPersistor();

            persistor.Persist(entity);

            persistor.LoadAll <OtherEntity>().Single().ShouldBeTheSameAs(entity);
        }
Ejemplo n.º 3
0
        public void persist()
        {
            var entity = new OtherEntity();
            var persistor = new InMemoryPersistor();

            persistor.Persist(entity);

            persistor.LoadAll<OtherEntity>().Single().ShouldBeTheSameAs(entity);
        }
Ejemplo n.º 4
0
        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");
        }
Ejemplo n.º 5
0
        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");
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
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().ShouldEqual(3);
            persistor.LoadAll <OtherEntity>().Count().ShouldEqual(2);
            persistor.LoadAll <ThirdEntity>().Count().ShouldEqual(0);
        }
Ejemplo n.º 11
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();
        }
Ejemplo n.º 13
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 InMemoryPersistenceReset(IPersistor persistor)
 {
     _persistor = persistor.As<InMemoryPersistor>();
 }