public void ThrowWhenArgumentIdIsNullOrEmpty() { var mockedMoviesService = new Mock <IMoviesService>(); var mockedScreeningService = new Mock <IFilmScreeningService>(); var mockedNavigationService = new Mock <INavigationService>(); string date = "3/22/2017"; string nullId = null; string price = "10"; var mockedPage = new Mock <Page>(); var actualAddFilmScreeningPresenter = new Presenters.FilmScreeningPresenters.AddFilmScreeningPresenter( mockedScreeningService.Object, mockedMoviesService.Object, mockedNavigationService.Object); Assert.That( () => actualAddFilmScreeningPresenter.CreateFilmScreening(date, nullId, price, mockedPage.Object), Throws.InstanceOf <ArgumentNullException>()); }
public void CallFilmScreeningServiceCreateMethodWithTheSameArguments() { var mockedMoviesService = new Mock <IMoviesService>(); var mockedScreeningService = new Mock <IFilmScreeningService>(); var mockedNavigationService = new Mock <INavigationService>(); string date = "3/22/2017"; string id = "1"; string price = "10"; var mockedPage = new Mock <Page>(); var actualAddFilmScreeningPresenter = new Presenters.FilmScreeningPresenters.AddFilmScreeningPresenter( mockedScreeningService.Object, mockedMoviesService.Object, mockedNavigationService.Object); actualAddFilmScreeningPresenter.CreateFilmScreening(date, id, price, mockedPage.Object); mockedScreeningService.Verify(service => service.Create(date, id, price), Times.Once); }
public void CallNavigationServiceRedirectMethod() { var mockedMoviesService = new Mock <IMoviesService>(); var mockedScreeningService = new Mock <IFilmScreeningService>(); var mockedNavigationService = new Mock <INavigationService>(); string date = "3/22/2017"; string id = "1"; string price = "10"; var mockedPage = new Mock <Page>(); mockedNavigationService.Setup(x => x.Redirect(It.IsAny <Page>(), It.IsAny <string>())); var actualAddFilmScreeningPresenter = new Presenters.FilmScreeningPresenters.AddFilmScreeningPresenter( mockedScreeningService.Object, mockedMoviesService.Object, mockedNavigationService.Object); actualAddFilmScreeningPresenter.CreateFilmScreening(date, id, price, mockedPage.Object); mockedNavigationService.Verify(service => service.Redirect(mockedPage.Object, It.IsAny <string>()), Times.Once); }