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 GivenNull_ThrowsArgNullException() { var preprocessor = new DefaultStationPreprocessor(); Assert.Throws<ArgumentNullException>(() => preprocessor.GetStationsLookups(null)); }
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 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 GivenLowecaseA_ResultIsCaseInsensetive() { var preprocessor = new DefaultStationPreprocessor(); Dictionary<string, List<string>> result = preprocessor.GetStationsLookups(new List<string> { "a" }); Assert.That(result.ContainsKey("A")); }
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>())); }