public void GivenAB_ReturnsPairWithKeyAB()
        {
            var preprocessor = new DefaultStationPreprocessor();
            var result = preprocessor.GetStationBeginnings("ab");

            Assert.That(result.SingleOrDefault(x => x.Key == "ab"), Is.Not.Null);
        }
        public void GivenAB_ReturnsPairWithKeyAMappedToAB()
        {
            var preprocessor = new DefaultStationPreprocessor();
            var result = preprocessor.GetStationBeginnings("ab");

            Assert.That(result.SingleOrDefault(x => x.Key == "a").Value, Is.EqualTo("ab"));
        }
        public void GivenA_Returns1KeyValuePair()
        {
            var preprocessor = new DefaultStationPreprocessor();
            var result = preprocessor.GetStationBeginnings("a");

            Assert.That(result.Count, Is.EqualTo(1));
        }
        public void GivenAB_Returns2Pairs()
        {
            var preprocessor = new DefaultStationPreprocessor();
            var result = preprocessor.GetStationBeginnings("ab");

            Assert.That(result.Count, Is.EqualTo(2));
        }
        public void GivenTokyo_Returns5Pairs()
        {
            var preprocessor = new DefaultStationPreprocessor();
            Dictionary<string, List<string>> result = preprocessor.GetStationsLookups(new List<string> { "Tokyo" });

            Assert.That(result.Count(), Is.EqualTo(5));
        }
        public void GivenTokyoAndTibet_ReturnsTWithTwoValues()
        {
            var preprocessor = new DefaultStationPreprocessor();
            Dictionary<string, List<string>> result = preprocessor.GetStationsLookups(new List<string> { "Tokyo", "Tibet" });

            Assert.That(result["t"].Count, Is.EqualTo(2) );
        }
 public void GivenNull_ThrowsArgNullException()
 {
     var preprocessor = new DefaultStationPreprocessor();
     Assert.Throws<ArgumentNullException>(() => preprocessor.GetStationsLookups(null));
 }
        public void GivenWhitespace_ReturnsEmptyList()
        {
            var preprocessor = new DefaultStationPreprocessor();
            var result = preprocessor.GetStationBeginnings("         \t          \n       ");

            Assert.That(result, Is.Empty);
        }
        public void GivenListOf2StationsWith1Letter_ReturnsLastStationWithCorrectValue()
        {
            var preprocessor = new DefaultStationPreprocessor();
            Dictionary<string, List<string>> result = preprocessor.GetStationsLookups(new List<string> { "a", "b" });

            Assert.That(result.SingleOrDefault(x => x.Value.Contains("b")), Is.Not.Null);
        }
        public void GivenListOf2StationsWith1Letter_Returns2KeyValuePairs()
        {
            var preprocessor = new DefaultStationPreprocessor();
            Dictionary<string, List<string>> result = preprocessor.GetStationsLookups(new List<string> { "a", "b" });

            Assert.That(result.Count, Is.EqualTo(2));
        }
        public void GivenListOf1StationNameWith1Letter_ReturnsCorrectValue()
        {
            var preprocessor = new DefaultStationPreprocessor();
            string expected = "a";

            Dictionary<string, List<string>> result = preprocessor.GetStationsLookups(new List<string> { expected });

            Assert.That(result.Single().Value.Single(), Is.EqualTo(expected));
        }
        public void GivenListOf1StationNameWith1Letter_ReturnsCorrectKey()
        {
            var preprocessor = new DefaultStationPreprocessor();
            Dictionary<string, List<string>> result = preprocessor.GetStationsLookups(new List<string> { "a" });

            Assert.That(result.Single().Key, Is.EqualTo("a"));
        }
        public void GivenEmptyList_ThrowsArgumentExceptionWithUsefulMessage()
        {
            var preprocessor = new DefaultStationPreprocessor();
            ArgumentException exception = null;
            try
            {
                preprocessor.GetStationsLookups(new List<string>());
            }
            catch (ArgumentException e)
            {
                exception = e;
            }

            Assert.That(exception.Message, Is.StringContaining("The list of stations was empty. We cannot possibly query an empty list of station names."));
        }
 public void GivenEmptyList_ThrowsArgumentException()
 {
     var preprocessor = new DefaultStationPreprocessor();
     Assert.Throws<ArgumentException>(() => preprocessor.GetStationsLookups(new List<string>()));
 }
        public void GivenLowecaseA_ResultIsCaseInsensetive()
        {
            var preprocessor = new DefaultStationPreprocessor();
            Dictionary<string, List<string>> result = preprocessor.GetStationsLookups(new List<string> { "a" });

            Assert.That(result.ContainsKey("A"));
        }
        public void GivenA_ReturnsWithValueA()
        {
            var preprocessor = new DefaultStationPreprocessor();
            var result = preprocessor.GetStationBeginnings("a");

            Assert.That(result.Single().Value, Is.EqualTo("a"));
        }
        public void GivenEmptyString_ReturnsEmptyList()
        {
            var preprocessor = new DefaultStationPreprocessor();
            var result = preprocessor.GetStationBeginnings(string.Empty);

            Assert.That(result, Is.Empty);
        }