public void NotFoundDvdReturnNull() { var repo = new DvdRepositoryADO(); var dvd = repo.GetDvdByID(1000); Assert.IsNull(dvd); }
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); }
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); }
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); }