Пример #1
0
        public void AddMovieItem_AvailableForRent()
        {
            var movie = new Movie(Session);

            Assert.IsFalse(movie.IsAvailableForRent);
            movie.AddItem();
            Assert.IsTrue(movie.IsAvailableForRent);
        }
Пример #2
0
        public void AllowDelete()
        {
            var movie = new Movie(Session, "1");
            var item  = movie.AddItem(MovieItemFormat.DVD, 10);

            Andrew.DoRent(new RentInfo(item));
            Session.CommitChanges();
            Assert.IsFalse(movie.AllowDelete);
        }
Пример #3
0
        void CreateMovie(UnitOfWork session, string title, int quanity)
        {
            Movie movie = new Movie(session, title);

            for (int i = 0; i < quanity; i++)
            {
                movie.AddItem(MovieItemFormat.DVD, 100);
            }
        }
Пример #4
0
        public void RentMovieByCustomer_AvailableForRent()
        {
            var movie = new Movie(Session);

            movie.AddItem(MovieItemFormat.DVD, 10);
            Assert.IsTrue(movie.IsAvailableForRent);
            var customer = new Customer(Session);
            var rent     = customer.DoRent(new RentInfo(movie)).Rents[0];

            Assert.IsNotNull(rent);
            Assert.AreEqual(1, rent.Days);
            Assert.AreEqual(customer, rent.Customer);
            Assert.AreEqual(movie.Items[0], rent.Item);
            Assert.IsFalse(movie.IsAvailableForRent);
            Assert.IsNull(customer.DoRent(new RentInfo(movie)));
        }