Пример #1
0
        public void commit_and_load_all()
        {
            var repo = theUnitOfWork.Start();

            repo.Update(new User());
            repo.Update(new User());
            repo.Update(new User());
            repo.Update(new OtherEntity());
            repo.Update(new OtherEntity());
            repo.Update(new ThirdEntity());

            theUnitOfWork.Commit();

            repo = theUnitOfWork.Start();

            repo.All <User>().Count().ShouldBe(3);
            repo.All <OtherEntity>().Count().ShouldBe(2);
            repo.All <ThirdEntity>().Count().ShouldBe(1);
        }
        public void reset_wipes_the_slate_clean()
        {
            var repo = theUnitOfWork.Start();

            repo.Update(new User());
            repo.Update(new User());
            repo.Update(new User());
            repo.Update(new OtherEntity());
            repo.Update(new OtherEntity());
            repo.Update(new ThirdEntity());

            theUnitOfWork.Commit();

            theReset.ClearPersistedState();

            repo = theUnitOfWork.Start();

            repo.All <User>().Count().ShouldEqual(0);
            repo.All <OtherEntity>().Count().ShouldEqual(0);
            repo.All <ThirdEntity>().Count().ShouldEqual(0);
        }