Exemplo n.º 1
0
        public void MockCanDeleteDvd()
        {
            var repo = new DvdRepositoryMock();
            var test = repo.GetAllDvd();

            Assert.AreEqual(3, test.Count());
            repo.Delete(3);
            test = repo.GetAllDvd();

            Assert.AreEqual(2, test.Count());
        }
Exemplo n.º 2
0
        public void MockCanLoadDvds()
        {
            var repo = new DvdRepositoryMock();
            var test = repo.GetAllDvd();

            Assert.AreEqual(2, test.Count());
        }
Exemplo n.º 3
0
        public void MockCanAddDvd()
        {
            var repo = new DvdRepositoryMock();

            string title        = "A new movie";
            int    releaseYear  = 2000;
            string directorName = "John";
            string ratingName   = "G";
            string notes        = "A note";

            repo.SaveNew(title, releaseYear, directorName, ratingName, notes);
            var test = repo.GetAllDvd();

            Assert.AreEqual(3, test.Count());
        }
Exemplo n.º 4
0
        public void MockCanEditDvd()
        {
            var    repo         = new DvdRepositoryMock();
            int    dvdId        = 2;
            string title        = "An edited movie";
            int    releaseYear  = 1999;
            string directorName = "Jacob";
            string ratingName   = "PG";
            string notes        = "A note";

            repo.Edit(dvdId, title, releaseYear, directorName, ratingName, notes);

            var test      = repo.GetAllDvd();
            var editedDvd = repo.GetById(2);

            Assert.AreEqual(2, editedDvd.DvdId);
            Assert.AreEqual("An edited movie", editedDvd.Title);
            Assert.AreEqual(1999, editedDvd.ReleaseYear);
            Assert.AreEqual("Jacob", editedDvd.Director);
            Assert.AreEqual("PG", editedDvd.Rating);
        }