Exemplo n.º 1
0
        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);
        }
Exemplo n.º 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);
        }