コード例 #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());
        }
コード例 #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);
        }
コード例 #3
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);
        }