public void CanAddDvd() { var repo = new DvdRepositoryEF(); Dvd dvdAdd = new Dvd(); var preAdd = repo.GetAll(); dvdAdd.Title = "A Player Hater's Ball"; dvdAdd.ReleaseYear = 1977; dvdAdd.DirectorName = "Silky Johnson"; dvdAdd.RatingType = "G"; dvdAdd.Notes = "The most diabolical haters this side of the Mississippi!"; repo.AddDvd(dvdAdd); var postAdd = repo.GetAll(); Assert.AreEqual(preAdd.Count + 1, postAdd.Count); var newDvd = repo.GetDvdById(4); Assert.AreEqual("A Player Hater's Ball", newDvd.Title); Assert.AreEqual(1977, newDvd.ReleaseYear); Assert.AreEqual("Silky Johnson", newDvd.DirectorName); Assert.AreEqual("G", newDvd.RatingType); }
public void CanDeleteDvd() { var repo = new DvdRepositoryEF(); 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) { DvdRepositoryEF repo = new DvdRepositoryEF(); 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 CanGetAll(bool expected) { DvdRepositoryEF repo = new DvdRepositoryEF(); var allDvds = repo.GetAll(); bool actual = allDvds != null; while (actual) { actual = allDvds[0].DvdId == 1; actual = allDvds[0].Title == "Mad Max: Fury Road"; actual = allDvds[0].RealeaseYear == 2015; actual = allDvds[0].Director == "George Miller"; actual = allDvds[0].Rating == "R"; actual = allDvds[0].Notes == "Some critics say \"Thirty-six viewings in a row is the only reasonable way to watch this film.\""; actual = allDvds[9].DvdId == 10; actual = allDvds[9].Title == "Boyz N The Hood"; actual = allDvds[9].RealeaseYear == 1992; actual = allDvds[9].Director == "John Singleton"; actual = allDvds[9].Rating == "R"; actual = allDvds[9].Notes == ""; break; } Assert.AreEqual(expected, actual); }
public void EFGetAllTest() { var repo = new DvdRepositoryEF(); List <Dvd> dvds = repo.GetAll(); Assert.IsNotNull(dvds); }
public void CanLoadDvds() { var repo = new DvdRepositoryEF(); var dvd = repo.GetAll(); Assert.AreEqual(3, dvd.Count); Assert.AreEqual("True Hollywood Stories", dvd[0].Title); }