public void ArgumentException_WhenInvalidCountOfArgumentsArePassed_AndIsSelectedBack(string inputParameters, string inputResult, string expected) { //Arrange var parameters = inputParameters.Split().ToList(); var userServicesMock = new Mock <IUserServices>(); var itemSelectorMock = new Mock <IItemSelector>(); var cinemaConsoleMock = new Mock <IAlphaCinemaConsole>(); var model = new ProjectionDetailsViewModel() { CityName = "Sofia", MovieName = "Titanic", Hour = "19:30h" }; //Setup itemSelectorMock.Setup(selector => selector .ReadAtPosition(It.IsAny <int>(), It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <int>())) .Returns(inputResult); itemSelectorMock.Setup(selector => selector .DisplayItems(It.IsAny <List <string> >())) .Returns("Back"); //Act var moviesByAge = new MoviesByAge(itemSelectorMock.Object, cinemaConsoleMock.Object, userServicesMock.Object); var result = moviesByAge.Execute(parameters); //Assert Assert.AreEqual(expected, result.First()); }
public void ReturnCorrectList_WhenArgumentsArePassed(string inputParameters, string inputResult, string expected) { //Arrange var parameters = inputParameters.Split().ToList(); var userServicesMock = new Mock <IUserServices>(); var itemSelectorMock = new Mock <IItemSelector>(); var cinemaConsoleMock = new Mock <IAlphaCinemaConsole>(); var model = new ProjectionDetailsViewModel() { CityName = "Sofia", MovieName = "Titanic", Hour = "19:30h" }; //Setup itemSelectorMock.Setup(selector => selector .ReadAtPosition(It.IsAny <int>(), It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <int>())) .Returns(inputResult); userServicesMock.Setup(userServices => userServices .GetMoviesByUserAge(It.IsAny <int>(), It.IsAny <int>())) .Returns(new List <ProjectionDetailsViewModel>() { model }); cinemaConsoleMock.Setup(console => console .ReadKey(It.IsAny <bool>())); //Act var moviesByAge = new MoviesByAge(itemSelectorMock.Object, cinemaConsoleMock.Object, userServicesMock.Object); var result = moviesByAge.Execute(parameters); //Assert Assert.AreEqual(expected, result.First()); }