Exemplo n.º 1
0
        [TestCase("FakeMovie", 1991, "Paul Rudd", "The Garage", MPAA.PG13, true)] //Correct information added. Pass.

        public void CanAddDVDTest(string title, int year, string director, string studio, MPAA rating, bool expectedResult)
        {
            bool           result;
            LibraryManager manager = LibraryManagerFactory.Create();
            DVD            mockDVD = new DVD();

            mockDVD.Title        = title;
            mockDVD.ReleaseYear  = year;
            mockDVD.DirectorName = director;
            mockDVD.Studio       = studio;
            mockDVD.MPAARating   = rating;


            manager.AddDVD(mockDVD);

            if (manager.GetAll().ToList().Count == 5)
            {
                result = true;
            }
            else
            {
                result = false;
            }

            Assert.AreEqual(expectedResult, result);
            Assert.AreEqual(mockDVD.DvdId, 5);
        }
Exemplo n.º 2
0
        public ActionResult AddDVD(DVDListVM model)
        {
            if (ModelState.IsValid)
            {
                DVD newDVD = new DVD();

                newDVD.Title        = model.dvd.Title;
                newDVD.ReleaseYear  = model.dvd.ReleaseYear;
                newDVD.DirectorName = model.dvd.DirectorName;
                newDVD.Studio       = model.dvd.Studio;
                newDVD.MPAARating   = model.dvd.MPAARating;

                newDVD.ActorList = model.dvd.ActorList;

                newDVD.UserNotes  = model.dvd.UserNotes;
                newDVD.UserRating = model.dvd.UserRating;

                _dvdManager.AddDVD(newDVD);

                return(RedirectToAction("Collection"));
            }
            else
            {
                return(View(model));
            }
        }