Example #1
0
        public void InvalidClientInputException_WhenParameterIsInvalid(string input, string inputParameters, string expected)
        {
            // Arrange
            var parameters = inputParameters.Split().ToList();

            var cinemaConsoleMock = new Mock <IAlphaCinemaConsole>();
            var cityServicesMock  = new Mock <ICityServices>();

            cinemaConsoleMock
            .Setup(c => c.ReadLineMiddle(It.IsAny <int>(), It.IsAny <int>()))
            .Returns("Sofia12");

            // Act
            var sut    = new RemoveCity(cityServicesMock.Object, cinemaConsoleMock.Object);
            var result = sut.Execute(parameters);

            //Assert
            Assert.AreEqual(expected, result.First());
        }
Example #2
0
        public void CityServicesDeleteMethod_IsCalled(string input, string inputParameters)
        {
            // Arrange
            var parameters = inputParameters.Split().ToList();

            var cinemaConsoleMock = new Mock <IAlphaCinemaConsole>();
            var cityServicesMock  = new Mock <ICityServices>();

            cinemaConsoleMock
            .Setup(c => c.ReadLineMiddle(It.IsAny <int>(), It.IsAny <int>()))
            .Returns("Sofia");

            // Act
            var sut    = new RemoveCity(cityServicesMock.Object, cinemaConsoleMock.Object);
            var result = sut.Execute(parameters);

            //Assert
            cityServicesMock.Verify(services => services.DeleteCity(It.IsAny <string>()), Times.Once);
        }