예제 #1
0
        public void ADOCanDeleteDvd()
        {
            var repo = new DvdRepositoryADO();
            var dvds = repo.GetAllDvd();

            Assert.AreEqual(4, dvds.Count());
            repo.Delete(4);
            dvds = repo.GetAllDvd();
            Assert.AreEqual(3, dvds.Count());
        }
        public void CanDeleteDvd()
        {
            Dvd dvd  = new Dvd();
            var repo = new DvdRepositoryADO();

            repo.Delete(4);

            var dvds = repo.GetAll();

            Assert.AreEqual(13, dvds.Count());
            Assert.AreEqual(null, repo.GetById(4));
        }
예제 #3
0
        public void ADOCanDelete(int id, bool expected)
        {
            bool actual = false;

            var repo = new DvdRepositoryADO();
            Dvd dvd  = repo.Get(id);

            if (dvd != null)
            {
                repo.Delete(id);


                dvd = repo.Get(id);

                if (dvd == null)
                {
                    actual = true;
                }
            }
            Assert.AreEqual(expected, actual);
        }
예제 #4
0
        public void CanDeleteADODvd()
        {
            Dvd DvdToAdd = new Dvd();
            var repo     = new DvdRepositoryADO();

            DvdToAdd.Title        = "My test Dvd";
            DvdToAdd.ReleaseYear  = 2020;
            DvdToAdd.DirectorName = "TestDirector";
            DvdToAdd.RatingName   = "R";
            DvdToAdd.Notes        = "This is for my test";

            repo.Insert(DvdToAdd);

            var loaded = repo.GetById(5);

            Assert.IsNotNull(loaded);

            repo.Delete(5);
            loaded = repo.GetById(5);

            Assert.IsNull(loaded);
        }