Ejemplo n.º 1
0
        public void TestStationFinderdart()
        {
            //Act
            var response = _stationFinder.GetSuggestions("dart");

            _suggestions.NextLetters = new HashSet <string>()
            {
                "F", "M"
            };
            _suggestions.Stations = new HashSet <string>()
            {
                "DARTFORD", "DARTMOUTH"
            };

            //Assert
            Assert.IsNotNull(response);
            Assert.AreEqual(response.Result.NextLetters.Count, 2);
            Assert.AreEqual(response.Result.Stations.Count, 2);
            Assert.AreEqual(response.Result.NextLetters, _suggestions.NextLetters);
            Assert.AreEqual(response.Result.Stations, _suggestions.Stations);
        }
Ejemplo n.º 2
0
        public void StationFinderShouldReturnAllStationsWhenNoInput()
        {
            var suggestions = _stationFinder.GetSuggestions("");

            Assert.Equal(3, suggestions.Stations.Count());
        }
Ejemplo n.º 3
0
        public void GIVEN_a_valid_request_WHEN_stationFinder_is_called_TEHN_should_call_GetName_once()
        {
            //Arrange
            var result = GetValidResult();

            _dataAccess.Setup(x => x.GetStationList()).Returns(result);
            _dataAccess.Setup(x => x.GetName(It.IsAny <string>())).ReturnsAsync("testgetname");

            //Act
            var response = _stationFinder.GetSuggestions("dart");

            //Assert
            _dataAccess.Verify(x => x.GetName(It.IsAny <string>()), Times.Once);
        }
Ejemplo n.º 4
0
 public void Run(string userInput)
 {
     _stationFinder.GetSuggestions(userInput);
 }
Ejemplo n.º 5
0
 public Suggestions FindStation(string userInput)
 {
     return(_stationFinder.GetSuggestions(userInput));
 }