示例#1
0
        public void NotFoundDvdReturnNull()
        {
            var repo = new DvdRepositoryADO();
            var dvd  = repo.GetDvdByID(1000);

            Assert.IsNull(dvd);
        }
示例#2
0
        public void CanUpdateDvd()
        {
            Dvd dvd  = new Dvd();
            var repo = new DvdRepositoryADO();

            dvd.DvdId       = 3;
            dvd.Title       = "Training Day";
            dvd.ReleaseYear = 2011;
            dvd.Director    = "Joe Blow";
            dvd.Rating      = "R";
            dvd.Notes       = null;

            repo.CreateDvd(dvd);

            //dvd.DvdId = 3;
            dvd.Title       = "Day";
            dvd.ReleaseYear = 2019;
            dvd.Director    = "That One Guy";
            dvd.Rating      = "R";
            dvd.Notes       = "Hello";

            repo.UpdateDvd(dvd);
            var updatedDvd = repo.GetDvdByID(3);

            Assert.AreEqual(3, updatedDvd.DvdId);
            Assert.AreEqual("Day", updatedDvd.Title);
            Assert.AreEqual(2019, updatedDvd.ReleaseYear);
            Assert.AreNotEqual("Joe Blow", updatedDvd.Director);
            Assert.AreEqual("Hello", updatedDvd.Notes);
        }
示例#3
0
        public void CanGetDvdById()
        {
            var repo = new DvdRepositoryADO();

            var dvd = repo.GetDvdByID(1);

            Assert.AreEqual(1, dvd.DvdId);
            Assert.AreEqual("The Lion King", dvd.Title);
            Assert.AreEqual(1992, dvd.ReleaseYear);
            Assert.AreNotEqual("Ehhhhh", dvd.Notes);
            Assert.AreEqual("Some Guy", dvd.Director);
        }
示例#4
0
        public void CanDeleteDvd()
        {
            Dvd dvd = new Dvd();

            var repo = new DvdRepositoryADO();

            dvd.DvdId       = 3;
            dvd.Title       = "Training Day";
            dvd.ReleaseYear = 2011;
            dvd.Director    = "Joe Blow";
            dvd.Rating      = "R";
            dvd.Notes       = null;

            repo.CreateDvd(dvd);

            var dvdToDelete = repo.GetDvdByID(3);

            Assert.IsNotNull(dvdToDelete);

            repo.DeleteDvd(3);
            dvdToDelete = repo.GetDvdByID(3);

            Assert.IsNull(dvdToDelete);
        }