コード例 #1
0
        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));
        }
コード例 #2
0
 public void GivenNull_ThrowsArgNullException()
 {
     var preprocessor = new DefaultStationPreprocessor();
     Assert.Throws<ArgumentNullException>(() => preprocessor.GetStationsLookups(null));
 }
コード例 #3
0
        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) );
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        public void GivenLowecaseA_ResultIsCaseInsensetive()
        {
            var preprocessor = new DefaultStationPreprocessor();
            Dictionary<string, List<string>> result = preprocessor.GetStationsLookups(new List<string> { "a" });

            Assert.That(result.ContainsKey("A"));
        }
コード例 #6
0
        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));
        }
コード例 #7
0
        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));
        }
コード例 #8
0
        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"));
        }
コード例 #9
0
        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."));
        }
コード例 #10
0
 public void GivenEmptyList_ThrowsArgumentException()
 {
     var preprocessor = new DefaultStationPreprocessor();
     Assert.Throws<ArgumentException>(() => preprocessor.GetStationsLookups(new List<string>()));
 }