public void ADOCanEditDvd() { DvdRepositoryADO repo = new DvdRepositoryADO(); Dvd dvdToAdd = new Dvd(); dvdToAdd.Title = "Grand Budapest Hotel"; dvdToAdd.Director = "Director B"; dvdToAdd.Rating = "R"; dvdToAdd.ReleaseYear = 2005; dvdToAdd.Notes = "funny movie"; repo.AddDvd(dvdToAdd); dvdToAdd.Title = "Pulp Fiction"; dvdToAdd.Director = "Quentin Tarantino"; dvdToAdd.ReleaseYear = 1998; dvdToAdd.Notes = "classic movie"; repo.EditDvd(dvdToAdd); var updatedDvd = repo.GetDvd(4); Assert.AreEqual("Pulp Fiction", updatedDvd.Title); Assert.AreEqual("Quentin Tarantino", updatedDvd.Director); Assert.AreEqual("R", updatedDvd.Rating); Assert.AreEqual(1998, updatedDvd.ReleaseYear); Assert.AreEqual("classic movie", updatedDvd.Notes); }
public void CanEditDvd(int id, string title, int year, string director, string rating, string notes, bool expected) { DvdRepositoryADO repo = new DvdRepositoryADO(); Dvd edit = new Dvd() { DvdId = id, Title = title, Director = director, RealeaseYear = year, Rating = rating, Notes = notes }; repo.EditDvd(edit, id); Dvd dvd = repo.GetById(id); bool actual; if (dvd == null) { actual = false; } else { actual = (dvd.DvdId == id && dvd.Title == title && dvd.RealeaseYear == year && dvd.Director == director && dvd.Rating == rating && dvd.Notes == notes); } Assert.AreEqual(expected, actual); }
public void CanEditDvd() { var repo = new DvdRepositoryADO(); //Dvd dvd = new Dvd(); var preEdit = repo.GetDvdById(1); preEdit.Title = "Pimp Chronicles"; preEdit.DirectorName = "Buck Nasty"; repo.EditDvd(preEdit); var postEdit = repo.GetDvdById(1); Assert.AreEqual("Pimp Chronicles", postEdit.Title); Assert.AreEqual("Buck Nasty", postEdit.DirectorName); }