public void ThrowInvalidClientInputException_WhenParametersAreInvalid(string inputParameters, string expected) { // Arrange var parameters = inputParameters.Split('|').ToList(); var movieServicesMock = new Mock <IMovieServices>(); var genreServicesMock = new Mock <IGenreServices>(); var movieGenreServicesMock = new Mock <IMovieGenreServices>(); var cinemaConsoleMock = new Mock <IAlphaCinemaConsole>(); movieServicesMock .Setup(ms => ms.GetID(parameters[0])) .Returns(1); genreServicesMock .Setup(gs => gs.GetID(parameters[1])) .Returns(1); cinemaConsoleMock .Setup(c => c.ReadLineMiddle(It.IsAny <int>(), It.IsAny <int>())) .Returns("venom|1234"); // Act var sut = new RemoveMovieGenre(genreServicesMock.Object, cinemaConsoleMock.Object, movieServicesMock.Object, movieGenreServicesMock.Object); var result = sut.Execute(parameters); // Assert Assert.AreEqual(expected, result.First()); }
public void DeleteMethod_IsCalled(string inputParameters) { // Arrange var parameters = inputParameters.Split('|').ToList(); var movieServicesMock = new Mock <IMovieServices>(); var genreServicesMock = new Mock <IGenreServices>(); var movieGenreServicesMock = new Mock <IMovieGenreServices>(); var cinemaConsoleMock = new Mock <IAlphaCinemaConsole>(); movieServicesMock .Setup(ms => ms.GetID(parameters[0])) .Returns(1); genreServicesMock .Setup(gs => gs.GetID(parameters[1])) .Returns(1); movieGenreServicesMock .Setup(mgs => mgs.Delete(1, 1)); cinemaConsoleMock .Setup(c => c.ReadLineMiddle(It.IsAny <int>(), It.IsAny <int>())) .Returns("Venom|Action"); // Act var sut = new RemoveMovieGenre(genreServicesMock.Object, cinemaConsoleMock.Object, movieServicesMock.Object, movieGenreServicesMock.Object); var result = sut.Execute(parameters); //Assert movieGenreServicesMock.Verify(mg => mg.Delete(It.IsAny <int>(), It.IsAny <int>()), Times.Once); }