Beispiel #1
0
        public void ShouldReturnOneValueFromArgumentEqualsToArgument_Test()
        {
            IWordsRangeService service = new WordsRangeService(_words);
            var res = service.GetRange("overface", "overface");

            Assert.AreEqual(1, res.Count());
        }
Beispiel #2
0
        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", ""));
        }
Beispiel #5
0
        public void ShouldThrowExceptionWithEmptyDictionary_Test()
        {
            IWordsRangeService service = new WordsRangeService(new string[] {});

            Assert.Throws <WordNotFoundException>(() => service.GetRange("overface", "azzuolo"));
        }
Beispiel #6
0
        public void ShouldThrowExceptionIfWordNotExistsInDictionary_Test()
        {
            IWordsRangeService service = new WordsRangeService(new string[] {});

            Assert.Throws <WordNotFoundException>(() => service.GetRange("fake_word", "fake_word2"));
        }