public void ADONotFoundDvdReturnsNull() { DvdRepositoryADO repo = new DvdRepositoryADO(); var dvd = repo.GetDvd(1000000000); Assert.IsNull(dvd); }
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 ADOCanListDvdsById(int dvdId, bool expected) { DvdRepositoryADO repo = new DvdRepositoryADO(); Dvd dvd = repo.GetDvd(dvdId); bool result = !(dvd is null); Assert.AreEqual(result, expected); }
public void ADOCanLoadDvdById() { DvdRepositoryADO repo = new DvdRepositoryADO(); var dvd = repo.GetDvd(1); Assert.IsNotNull(dvd); Assert.AreEqual(1, dvd.DvdId); Assert.AreEqual("Office Space", dvd.Title); Assert.AreEqual("Director A", dvd.Director); Assert.AreEqual("R", dvd.Rating); Assert.AreEqual(1999, dvd.ReleaseYear); Assert.AreEqual("funny movie", dvd.Notes); }
public void ADOCanDeleteDvd() { 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); var loaded = repo.GetDvd(4); Assert.IsNotNull(loaded); repo.DeleteDvd(4); loaded = repo.GetDvd(4); Assert.IsNull(loaded); }