public void AddNewCityIsCalled_WhenParametersAreCorrect(string input, string consoleResult) { //Arrange var parameters = input.Split().ToList(); var cinemaConsoleMock = new Mock <IAlphaCinemaConsole>(); cinemaConsoleMock.Setup(console => console.ReadLineMiddle(It.IsAny <int>(), It.IsAny <int>())).Returns(consoleResult); var unitOfWorkMock = new Mock <IUnitOfWork>(); var cityServiceMock = new Mock <ICityServices>(); //Act var addCity = new AddCity(cityServiceMock.Object, cinemaConsoleMock.Object); var result = addCity.Execute(parameters); //Arrange cityServiceMock.Verify(cityService => cityService.AddNewCity(It.IsAny <string>()), Times.Once); }
public void ReturnCorrectList_WhenCityNameIsValid(string input, string consoleResult, string expected) { //Arrange var parameters = input.Split().ToList(); var cinemaConsoleMock = new Mock <IAlphaCinemaConsole>(); cinemaConsoleMock.Setup(console => console.ReadLineMiddle(It.IsAny <int>(), It.IsAny <int>())).Returns(consoleResult); var unitOfWorkMock = new Mock <IUnitOfWork>(); var cityServiceMock = new Mock <ICityServices>(); //Act var addCity = new AddCity(cityServiceMock.Object, cinemaConsoleMock.Object); var result = addCity.Execute(parameters); //Arrange Assert.AreEqual(expected, result.First()); }