public void ADOCanRemoveDvd(int dvdId, bool expected) { DvdRepositoryADO repo = new DvdRepositoryADO(); bool result = repo.DeleteDvd(dvdId); Assert.AreEqual(result, expected); }
public void CanDeleteDvd() { var repo = new DvdRepositoryADO(); var preDelete = repo.GetAll(); repo.DeleteDvd(3); var postDelete = repo.GetAll(); Assert.AreEqual(preDelete.Count - 1, postDelete.Count()); }
public void CanDeleteDvd(int id, bool expected) { DvdRepositoryADO repo = new DvdRepositoryADO(); bool actual = repo.GetAll().Any(d => d.DvdId == id); if (actual) { repo.DeleteDvd(id); actual = !(repo.GetAll().Any(d => d.DvdId == id)); } Assert.AreEqual(expected, actual); }
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); }
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); }