public void InitiateNewUpdateFilmScreeningsPresenterInstanceWhenProperDependancyIsPassed() { var mockedScreeningService = new Mock <IFilmScreeningService>(); var actualUpdateFilmScreeningPresenter = new Presenters.FilmScreeningPresenters.UpdateFilmScreeningPresenter(mockedScreeningService.Object); Assert.IsInstanceOf( typeof(Presenters.FilmScreeningPresenters.UpdateFilmScreeningPresenter), actualUpdateFilmScreeningPresenter); }
public void CallFilmScreeningServiceGetByIdMethodWithTheSameId(string validId) { var mockedScreeningService = new Mock <IFilmScreeningService>(); var actualUpdateFilmScreeningPresenter = new Presenters.FilmScreeningPresenters.UpdateFilmScreeningPresenter(mockedScreeningService.Object); actualUpdateFilmScreeningPresenter.GetScreeningById(validId); mockedScreeningService.Verify(service => service.GetById(validId), Times.Once); }
public void ThrowWhenIsCalledWithNullOrEmptyParameterId() { var mockedScreeningService = new Mock <IFilmScreeningService>(); string nullId = null; var actualUpdateFilmScreeningPresenter = new Presenters.FilmScreeningPresenters.UpdateFilmScreeningPresenter(mockedScreeningService.Object); Assert.That( () => actualUpdateFilmScreeningPresenter.GetScreeningById(nullId), Throws.InstanceOf <ArgumentNullException>()); }
public void ThrowWhenParameterUpdatedScreeningIsNull() { var mockedScreeningService = new Mock <IFilmScreeningService>(); string screeningId = "1"; FilmScreening nullScreening = null; var actualUpdateFilmScreeningPresenter = new Presenters.FilmScreeningPresenters.UpdateFilmScreeningPresenter(mockedScreeningService.Object); Assert.That( () => actualUpdateFilmScreeningPresenter.UpdateScreening(screeningId, nullScreening), Throws.InstanceOf <ArgumentNullException>()); }
public void ReturnFilmSCreeningWhenIsCalled() { var mockedScreeningService = new Mock <IFilmScreeningService>(); string validId = "1"; mockedScreeningService.Setup(s => s.GetById(It.IsAny <string>())).Returns(new FilmScreening()); var actualUpdateFilmScreeningPresenter = new Presenters.FilmScreeningPresenters.UpdateFilmScreeningPresenter(mockedScreeningService.Object); var result = actualUpdateFilmScreeningPresenter.GetScreeningById(validId); Assert.That(result, Is.Not.Null.And.InstanceOf <FilmScreening>()); }
public void CallFilmScreeningServiceUpdateByIdMethodWithTheSameArguments() { var mockedScreeningService = new Mock <IFilmScreeningService>(); string screeningId = "1"; var mockedScreening = new Mock <FilmScreening>(); var actualUpdateFilmScreeningPresenter = new Presenters.FilmScreeningPresenters.UpdateFilmScreeningPresenter(mockedScreeningService.Object); actualUpdateFilmScreeningPresenter.UpdateScreening(screeningId, mockedScreening.Object); mockedScreeningService.Verify( service => service.UpdateById(screeningId, mockedScreening.Object), Times.Once); }