Esempio n. 1
0
        public void ThrowWhenPassedPageIsNull()
        {
            var  mockedMoviesService     = new Mock <IMoviesService>();
            var  mockedNavigationService = new Mock <INavigationService>();
            var  mockedMovie             = new Mock <Movie>();
            Page nullPage = null;

            var actualGetMoviesPresenter =
                new Presenters.MoviePresenters.AddMoviePresenter(mockedMoviesService.Object, mockedNavigationService.Object);

            Assert.That(
                () => actualGetMoviesPresenter.CreateMovie(mockedMovie.Object, nullPage),
                Throws.InstanceOf <ArgumentNullException>());
        }
Esempio n. 2
0
        public void CallMoviesServiceCreateMethodWhenPropperDependanciesArePassed()
        {
            var mockedMoviesService     = new Mock <IMoviesService>();
            var mockedNavigationService = new Mock <INavigationService>();
            var mockedMovie             = new Mock <Movie>();
            var mockedPage = new Mock <Page>();

            var actualGetMoviesPresenter =
                new Presenters.MoviePresenters.AddMoviePresenter(mockedMoviesService.Object, mockedNavigationService.Object);

            actualGetMoviesPresenter.CreateMovie(mockedMovie.Object, mockedPage.Object);

            mockedMoviesService.Verify(service => service.Create(mockedMovie.Object), Times.Once);
        }
Esempio n. 3
0
        public void CallNavigationServiceCreateMethodWhenPropperDependanciesArePassed()
        {
            var mockedMoviesService     = new Mock <IMoviesService>();
            var mockedNavigationService = new Mock <INavigationService>();
            var mockedMovie             = new Mock <Movie>();
            var mockedPage = new Mock <Page>();

            mockedNavigationService.Setup(x => x.Redirect(It.IsAny <Page>(), It.IsAny <string>()));

            var actualGetMoviesPresenter =
                new Presenters.MoviePresenters.AddMoviePresenter(mockedMoviesService.Object, mockedNavigationService.Object);

            actualGetMoviesPresenter.CreateMovie(mockedMovie.Object, mockedPage.Object);

            mockedNavigationService.Verify(service => service.Redirect(mockedPage.Object, It.IsAny <string>()), Times.Once);
        }