Exemplo n.º 1
0
        public void SearchTestWithCompleteAndIncompleteTerms()
        {
            //Arrange
            var controller = new TicketController(new StationService(new StationRepository(new CacheStation(new DbContext()))));

            var expected = new StationResponse
            {
                Stations = new List <string>
                {
                    "LIVERPOOL",
                    "LIVERPOOL LIME STREET"
                },
                NextCharacters = new List <string>
                {
                    " "
                }
            };

            //Act
            var result = controller.GetStation("LIVERPOOL") as OkNegotiatedContentResult <StationResponse>;

            //Assert
            Assert.IsNotNull(result.Content);
            CollectionAssert.AreEqual(expected.Stations, result.Content.Stations);
            CollectionAssert.AreEqual(expected.NextCharacters, result.Content.NextCharacters);
        }
Exemplo n.º 2
0
        public void SearchTestWithUnexistentTerm()
        {
            //Arrange
            var controller = new TicketController(new StationService(new StationRepository(new CacheStation(new DbContext()))));

            var expected = new StationResponse
            {
                Message = "Station Not Found."
            };

            //Act
            var result = controller.GetStation("KING CROSS") as OkNegotiatedContentResult <StationResponse>;

            //Assert
            Assert.IsNotNull(result.Content);
            Assert.AreEqual(expected.Message, result.Content.Message);
        }