public void OpenLeasing(int movieCopyId)
        {
            var movieCopy = _context.MoviesCopies.Single(c => c.Id == movieCopyId);
            var movie     = _context.MoviesOriginal.Single(m => m.Id == movieCopy.MovieId);

            _leasingPresenter.Run(movie, movieCopy);

            var movieCopies = _context.MoviesCopies.Where(c => c.MovieId == movie.Id);

            _mainView.RedrawCopies(movieCopies);

            var leasings  = _context.LeasedCopies.Where(l => l.MovieCopyId == movieCopy.Id);
            var customers = _context.Customers;

            _mainView.RedrawLeasings(leasings, customers);
        }
Пример #2
0
        public void Run()
        {
            //arrange
            var movieTest     = new MovieOriginal("TEST MOVIE", "TEST MOVIE DESCR", 9999);
            var movieCopyTest = new MovieCopy(1111, "TEST COMMENT", 1111);

            //act
            _presenter.Run(movieTest, movieCopyTest);

            //assert
            Assert.AreEqual(movieTest.Title, _view.CurrentMovie.Title);
            Assert.AreEqual(movieTest.Description, _view.CurrentMovie.Description);
            Assert.AreEqual(movieTest.YearReleased, _view.CurrentMovie.YearReleased);

            Assert.AreEqual(movieCopyTest.MovieId, _view.CurrentMovieCopy.MovieId);
            Assert.AreEqual(movieCopyTest.Commentary, _view.CurrentMovieCopy.Commentary);
            Assert.AreEqual(movieCopyTest.PricePerDay, _view.CurrentMovieCopy.PricePerDay);

            _view.Received().RedrawCustomers(Arg.Any <IQueryable <Customer> >());
            _view.Received().Show();
        }