public void CanUpdateDvdMock()
        {
            Dvd dvdToAdd = new Dvd();
            var repo     = new DvdRepositoryMock();

            dvdToAdd.Title        = "New Dvd";
            dvdToAdd.ReleaseYear  = 2000;
            dvdToAdd.DirectorName = "Director";
            dvdToAdd.RatingName   = "G";
            dvdToAdd.Notes        = "This is my new dvd";
            repo.Insert(dvdToAdd);

            dvdToAdd.Title        = "A New Title for New Dvd";
            dvdToAdd.ReleaseYear  = 2001;
            dvdToAdd.DirectorName = "New Director";
            dvdToAdd.RatingName   = "PG-13";
            dvdToAdd.Notes        = "This is my newer dvd. Nice!";
            repo.Update(dvdToAdd);

            var updatedDvd = repo.GetById(7);

            Assert.AreEqual("A New Title for New Dvd", updatedDvd.Title);
            Assert.AreEqual(2001, updatedDvd.ReleaseYear);
            Assert.AreEqual("New Director", updatedDvd.DirectorName);
            Assert.AreEqual("PG-13", updatedDvd.RatingName);
            Assert.AreEqual("This is my newer dvd. Nice!", updatedDvd.Notes);
        }
Beispiel #2
0
        public void CanUpdateDvd()
        {
            Dvd dvd  = new Dvd();
            var repo = new DvdRepositoryMock();

            dvd.Title       = "The Lord of the Rings: The Two Towers";
            dvd.ReleaseYear = 2002;
            dvd.Director    = "Peter Jackson";
            dvd.Rating      = "PG-13";
            dvd.Notes       = "While Frodo and Sam edge closer to Mordor with the help of the shifty Gollum, the divided fellowship makes a stand against Sauron's new ally, Saruman, and his hordes of Isengard.";

            repo.Insert(dvd);
            dvd = repo.GetById(15);

            dvd.Title       = "Goodfellas";
            dvd.ReleaseYear = 1990;
            dvd.Director    = "Martin Scorsese";
            dvd.Rating      = "R";
            dvd.Notes       = "The story of Henry Hill and his life through the teen years into the years of mafia, covering his relationship with his wife Karen Hill and his Mob partners Jimmy Conway and Tommy DeVito in the Italian-American crime syndicate.";

            repo.Update(dvd);

            Dvd updatedDvd = repo.GetById(15);

            Assert.AreEqual("Goodfellas", updatedDvd.Title);
            Assert.AreEqual(1990, updatedDvd.ReleaseYear);
            Assert.AreEqual("Martin Scorsese", updatedDvd.Director);
            Assert.AreEqual("R", updatedDvd.Rating);
            Assert.AreEqual("The story of Henry Hill and his life through the teen years into the years of mafia, covering his relationship with his wife Karen Hill and his Mob partners Jimmy Conway and Tommy DeVito in the Italian-American crime syndicate.", updatedDvd.Notes);
        }
Beispiel #3
0
        public void CanAddDvd()
        {
            Dvd dvd  = new Dvd();
            var repo = new DvdRepositoryMock();

            dvd.Title       = "The Lord of the Rings: The Two Towers";
            dvd.ReleaseYear = 2002;
            dvd.Director    = "Peter Jackson";
            dvd.Rating      = "PG-13";
            dvd.Notes       = "While Frodo and Sam edge closer to Mordor with the help of the shifty Gollum, the divided fellowship makes a stand against Sauron's new ally, Saruman, and his hordes of Isengard.";

            repo.Insert(dvd);

            Assert.AreEqual(15, dvd.DvdId);
            Assert.AreEqual("The Lord of the Rings: The Two Towers", dvd.Title);
        }
        public void CanInsertDvdMock()
        {
            Dvd dvdToAdd = new Dvd();
            var repo     = new DvdRepositoryMock();

            dvdToAdd.Title        = "New Dvd";
            dvdToAdd.ReleaseYear  = 2020;
            dvdToAdd.DirectorName = "Me";
            dvdToAdd.RatingName   = "G";
            dvdToAdd.Notes        = "This is my new dvd";

            repo.Insert(dvdToAdd);

            Assert.AreEqual(7, dvdToAdd.DvdId);
            Assert.AreEqual("New Dvd", dvdToAdd.Title);
            Assert.AreEqual(2020, dvdToAdd.ReleaseYear);
            Assert.AreEqual("Me", dvdToAdd.DirectorName);
            Assert.AreEqual("G", dvdToAdd.RatingName);
            Assert.AreEqual("This is my new dvd", dvdToAdd.Notes);
        }
        public void CanDeleteDvdMock()
        {
            Dvd dvdToAdd = new Dvd();
            var repo     = new DvdRepositoryMock();

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

            repo.Insert(dvdToAdd);

            var loaded = repo.GetById(7);

            Assert.IsNotNull(loaded);

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

            Assert.IsNull(loaded);
        }