コード例 #1
0
        public void ADOCanEditDvd()
        {
            DvdRepositoryADO repo = new DvdRepositoryADO();
            Dvd dvdToAdd          = new Dvd();

            dvdToAdd.Title       = "Grand Budapest Hotel";
            dvdToAdd.Director    = "Director B";
            dvdToAdd.Rating      = "R";
            dvdToAdd.ReleaseYear = 2005;
            dvdToAdd.Notes       = "funny movie";

            repo.AddDvd(dvdToAdd);

            dvdToAdd.Title       = "Pulp Fiction";
            dvdToAdd.Director    = "Quentin Tarantino";
            dvdToAdd.ReleaseYear = 1998;
            dvdToAdd.Notes       = "classic movie";

            repo.EditDvd(dvdToAdd);
            var updatedDvd = repo.GetDvd(4);

            Assert.AreEqual("Pulp Fiction", updatedDvd.Title);
            Assert.AreEqual("Quentin Tarantino", updatedDvd.Director);
            Assert.AreEqual("R", updatedDvd.Rating);
            Assert.AreEqual(1998, updatedDvd.ReleaseYear);
            Assert.AreEqual("classic movie", updatedDvd.Notes);
        }
コード例 #2
0
        public void ADOCanAddDvd()
        {
            DvdRepositoryADO repo = new DvdRepositoryADO();
            Dvd dvdToAdd          = new Dvd();

            dvdToAdd.Title       = "Grand Budapest Hotel";
            dvdToAdd.Director    = "Director B";
            dvdToAdd.Rating      = "R";
            dvdToAdd.ReleaseYear = 2005;
            dvdToAdd.Notes       = "funny movie";

            repo.AddDvd(dvdToAdd);

            Assert.AreEqual(4, dvdToAdd.DvdId);
        }
コード例 #3
0
ファイル: AdoTest.cs プロジェクト: nikolasclay/Project
        public void CanAddDvd()
        {
            var repo   = new DvdRepositoryADO();
            Dvd dvdAdd = new Dvd();

            dvdAdd.Title        = "A Player Hater's Ball";
            dvdAdd.ReleaseYear  = 1977;
            dvdAdd.DirectorName = "Silky Johnson";
            dvdAdd.RatingType   = "G";
            dvdAdd.Notes        = "The most diabolical haters this side of the Mississippi!";

            repo.AddDvd(dvdAdd);
            var newDvd = repo.GetDvdById(4);

            Assert.AreEqual("A Player Hater's Ball", newDvd.Title);
            Assert.AreEqual(1977, newDvd.ReleaseYear);
            Assert.AreEqual("Silky Johnson", newDvd.DirectorName);
            Assert.AreEqual("G", newDvd.RatingType);
        }
コード例 #4
0
        public void ADOCanDeleteDvd()
        {
            DvdRepositoryADO repo = new DvdRepositoryADO();
            Dvd dvdToAdd          = new Dvd();

            dvdToAdd.Title       = "Grand Budapest Hotel";
            dvdToAdd.Director    = "Director B";
            dvdToAdd.Rating      = "R";
            dvdToAdd.ReleaseYear = 2005;
            dvdToAdd.Notes       = "funny movie";

            repo.AddDvd(dvdToAdd);

            var loaded = repo.GetDvd(4);

            Assert.IsNotNull(loaded);

            repo.DeleteDvd(4);
            loaded = repo.GetDvd(4);

            Assert.IsNull(loaded);
        }
コード例 #5
0
        public void CanAddDvd(string title, int year, string director, string rating, string notes, bool expected)
        {
            DvdRepositoryADO repo = new DvdRepositoryADO();

            Dvd dvd = new Dvd()
            {
                Title = title, Director = director, RealeaseYear = year, Rating = rating, Notes = notes
            };

            repo.AddDvd(dvd);

            var fromRepo = repo.GetById(dvd.DvdId);

            bool actual = (fromRepo != null &&
                           dvd.Title == fromRepo.Title &&
                           dvd.RealeaseYear == fromRepo.RealeaseYear &&
                           dvd.Director == fromRepo.Director &&
                           dvd.Rating == fromRepo.Rating &&
                           dvd.Notes == fromRepo.Notes);

            Assert.AreEqual(expected, actual);
        }