public void ShouldReturnOneValueFromArgumentEqualsToArgument_Test() { IWordsRangeService service = new WordsRangeService(_words); var res = service.GetRange("overface", "overface"); Assert.AreEqual(1, res.Count()); }
public void ShouldReturnExpectedRangeWithIfFromGreaterTo_Test() { IWordsRangeService service = new WordsRangeService(_words); var res = service.GetRange("overface", "azzuolo"); Assert.AreEqual(23, res.Count()); }
public void ShouldReturnExpectedRange_Test() { IWordsRangeService service = new WordsRangeService(_words); var controller = new WordController(service) { Request = new HttpRequestMessage(), Configuration = new HttpConfiguration() }; // Act on Test var response = controller.Get("azzuolo", "overface"); Assert.AreEqual(23, response.Count()); }
public void ShouldThrowExceptionIfArgumentsInvalid_Test() { IWordsRangeService service = new WordsRangeService(_words); var controller = new WordController(service) { Request = new HttpRequestMessage(), Configuration = new HttpConfiguration() }; // Act on Test Assert.Throws <InvalidWordRangeArgumentException>(() => controller.Get("", "overface")); Assert.Throws <InvalidWordRangeArgumentException>(() => controller.Get("overface", "")); }
public void ShouldThrowExceptionWithEmptyDictionary_Test() { IWordsRangeService service = new WordsRangeService(new string[] {}); Assert.Throws <WordNotFoundException>(() => service.GetRange("overface", "azzuolo")); }
public void ShouldThrowExceptionIfWordNotExistsInDictionary_Test() { IWordsRangeService service = new WordsRangeService(new string[] {}); Assert.Throws <WordNotFoundException>(() => service.GetRange("fake_word", "fake_word2")); }