Esempio n. 1
0
        public void ADOGetDvdByYear()
        {
            var repo = new DvdRepositoryADO();
            int year = 1444;
            var dvd  = repo.GetByYear(year);

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

            Assert.AreEqual(2, dvd[0].DvdId);
            Assert.AreEqual("That old movie", dvd[0].Title);
            Assert.AreEqual(1444, dvd[0].ReleaseYear);
            Assert.AreEqual("John", dvd[0].Director);
            Assert.AreEqual("PG-13", dvd[0].Rating);
            Assert.AreEqual("Movie did not age well", dvd[0].Notes);
        }
        public void CanGetByYear(int year, bool expected)
        {
            DvdRepositoryADO repo = new DvdRepositoryADO();

            List <Dvd> result = repo.GetByYear(year);

            bool actual;

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

            Assert.AreEqual(expected, actual);
        }