Exemplo n.º 1
0
        public void CanDelete()
        {
            var repo = new DvdRepositoryEntity();

            var dvds = repo.GetAll().ToList();

            int TestId = dvds[4].DvdId;

            repo.Delete(TestId);

            Assert.AreEqual(13, repo.GetAll().Count());
        }
Exemplo n.º 2
0
        public void CanLoadDvds()
        {
            var repo = new DvdRepositoryEntity();

            var dvds = repo.GetAll().ToList();

            Assert.AreEqual(14, dvds.Count());

            Assert.AreEqual("12 Angry Men", dvds[4].Title);
            Assert.AreEqual(1957, dvds[4].ReleaseYear);
            Assert.AreEqual("Sidney Lumet", dvds[4].Director);
            Assert.AreEqual("PG", dvds[4].Rating);
            Assert.AreEqual("A jury holdout attempts to prevent a miscarriage of justice by forcing his colleagues to reconsider the evidence.", dvds[4].Notes);
        }
Exemplo n.º 3
0
        public void CanAddDvd()
        {
            DVDLibrary.Models.Dvd dvd = new DVDLibrary.Models.Dvd();
            var repo = new DvdRepositoryEntity();

            dvd.Title       = "Frozen";
            dvd.ReleaseYear = 2008;
            dvd.Director    = "Disney";
            dvd.Rating      = "G";
            dvd.Notes       = "Brr... So cold.";
            repo.Insert(dvd);

            var dvdx = repo.GetBySearch("title", "Frozen").First();

            Assert.AreEqual("Disney", dvdx.Director);
        }
Exemplo n.º 4
0
        public static void DeleteAllFromDb()
        {
            var repo = new DvdRepositoryEntity();

            var dvds = repo.GetAll().ToList();

            // movie exists?
            foreach (var dvd in dvds)
            {
                int id = dvd.DvdId;
                repo.Delete(id);
            }

            Migrations.Configuration configuration = new Migrations.Configuration();
            DvdLibraryEntities       entities      = new DvdLibraryEntities();

            configuration.Seed(entities);
        }