public DummyMockedNewMovieRepository()
        {
            using (var mock = AutoMock.GetStrict())
            {
                mock.Mock <INewMovieRepository>().Setup(_inewmRepo => _inewmRepo.CreateMovie(It.IsAny <string>(), It.IsAny <Nullable <int> >(), It.IsAny <int>(),
                                                                                             It.IsAny <Nullable <DateTime> >(), It.IsAny <string>(), It.IsAny <byte[]>(), It.IsAny <int>()))
                .Callback((string tit, Nullable <int> pg, int gen, Nullable <DateTime> date, string sum, byte[] pict, int dur) =>
                {
                    mov = new Movie {
                        id = 10, title = tit, pg = pg, genre = gen, year = date, summary = sum, picture = pict, duration = dur
                    };
                    movies.Add(mov);
                });

                mock.Mock <INewMovieRepository>().Setup(_inewmRepo => _inewmRepo.SaveMovie()).Callback(() =>
                {
                    movies.Add(mov);
                });

                mock.Mock <INewMovieRepository>().Setup(_inewmRepo => _inewmRepo.LastMovieId()).Returns(movies.Last().id);

                _inewmRepo = mock.Create <INewMovieRepository>();
            }
        }
Пример #2
0
 public int IdOfTheLastMovie()
 {
     return(movie_repo.LastMovieId());
 }