Example #1
0
        public void DeleteStorableItemByExistingId()
        {
            IStoreable addStorable = new Storable();

            addStorable.Id = 1;
            RepositoryImplementation <IStoreable> ri = new RepositoryImplementation <IStoreable>();

            ri.Save(addStorable);
            addStorable.Id = 2;
            ri.Save(addStorable);
            addStorable.Id = 3;
            ri.Save(addStorable);

            List <IStoreable> preDeleteCount = ri.All().ToList();

            ri.Delete(3);

            List <IStoreable> postDeleteCount = ri.All().ToList();

            Assert.IsTrue(preDeleteCount.Count == (postDeleteCount.Count + 1));
        }
Example #2
0
        public void DeleteStorableItemByInvalidIdNoDeleteionTalkesPlaceNoErrors()
        {
            IStoreable addStorable = new Storable();

            addStorable.Id = 1;
            RepositoryImplementation <IStoreable> ri = new RepositoryImplementation <IStoreable>();

            ri.Save(addStorable);
            addStorable.Id = 2;
            ri.Save(addStorable);
            addStorable.Id = 3;
            ri.Save(addStorable);

            List <IStoreable> preDeleteCount = ri.All().ToList();

            ri.Delete(4);

            List <IStoreable> postDeleteCount = ri.All().ToList();

            Assert.IsTrue(preDeleteCount.Count == (postDeleteCount.Count));
        }
Example #3
0
        public void GetAllStorableItem()
        {
            IStoreable addStorable = new Storable();

            addStorable.Id = 1;
            RepositoryImplementation <IStoreable> ri = new RepositoryImplementation <IStoreable>();

            ri.Save(addStorable);
            addStorable.Id = 2;
            ri.Save(addStorable);
            addStorable.Id = 3;
            ri.Save(addStorable);

            List <IStoreable> allStore = ri.All().ToList();

            Assert.IsTrue(allStore.Count == 3);
        }