コード例 #1
0
ファイル: AdoTest.cs プロジェクト: nikolasclay/Project
        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());
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        public void ADOGetAllTest()
        {
            var        repo = new DvdRepositoryADO();
            List <Dvd> dvds = repo.GetAll();

            Assert.IsNotNull(dvds);
        }
コード例 #4
0
        public void CanGetAll(bool expected)
        {
            DvdRepositoryADO repo = new DvdRepositoryADO();

            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);
        }
コード例 #5
0
        public void CanLoadADODvds()
        {
            var repo = new DvdRepositoryADO();
            var dvds = repo.GetAll();

            Assert.AreEqual(4, dvds.Count);
            Assert.AreEqual("A Bugs Life", dvds[1].Title);
            Assert.AreEqual(1988, dvds[2].ReleaseYear);
        }
コード例 #6
0
ファイル: AdoTest.cs プロジェクト: nikolasclay/Project
        public void CanLoadDvds()
        {
            var repo = new DvdRepositoryADO();

            var dvd = repo.GetAll();

            Assert.AreEqual(3, dvd.Count);
            Assert.AreEqual("True Hollywood Stories", dvd[0].Title);
        }
コード例 #7
0
        public void CanDeleteDvd()
        {
            Dvd dvd  = new Dvd();
            var repo = new DvdRepositoryADO();

            repo.Delete(4);

            var dvds = repo.GetAll();

            Assert.AreEqual(13, dvds.Count());
            Assert.AreEqual(null, repo.GetById(4));
        }
コード例 #8
0
        public void CanLoadDvds()
        {
            var repo = new DvdRepositoryADO();

            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);
        }