public void CanGetByRating(string rating, bool expected)
        {
            DvdRepositoryADO repo = new DvdRepositoryADO();

            List <Dvd> result = repo.GetByRating(rating);

            bool actual;

            if (result.Count == 0)
            {
                actual = false;
            }
            else
            {
                actual = result.All(d => d.Rating == rating);
            }

            Assert.AreEqual(expected, actual);
        }
Beispiel #2
0
        public void ADOGetDvdByRating()
        {
            var    repo   = new DvdRepositoryADO();
            string rating = "R";
            var    dvd    = repo.GetByRating(rating);

            Assert.AreEqual(2, dvd.Count());

            Assert.AreEqual(3, dvd[0].DvdId);
            Assert.AreEqual("That other movie", dvd[0].Title);
            Assert.AreEqual(2030, dvd[0].ReleaseYear);
            Assert.AreEqual("Jacob", dvd[0].Director);
            Assert.AreEqual("R", dvd[0].Rating);
            Assert.AreEqual("A ways off", dvd[0].Notes);

            Assert.AreEqual(4, dvd[1].DvdId);
            Assert.AreEqual("A movie", dvd[1].Title);
            Assert.AreEqual(2017, dvd[1].ReleaseYear);
            Assert.AreEqual("Schmidt", dvd[1].Director);
            Assert.AreEqual("R", dvd[1].Rating);
            Assert.AreEqual("Eh, no comment", dvd[1].Notes);
        }