示例#1
0
        public void NearbyWords_should_HandleNullWords()
        {
            //arrange
            var target = new NearbyWords(new WordHelperStub());

            //act
            var result = target.GetWords(null);

            //assert
            result.Count().ShouldEqual(0);
        }
示例#2
0
        public void NearbyWords_should_ReturnValidResults()
        {
            //arrange
            var target = new NearbyWords(new WordHelperStub());

            //act
            var result = target.GetWords("gi").ToList();

            //assert
            result.ShouldContain("hi");
            result.ShouldContain("go");
        }
示例#3
0
        public void NearbyWords_should_ReturnCorrectNumberOfPermutations()
        {
            //arrange
            var helperMock = new Mock<IWordHelper>();
            helperMock.Setup(h => h.IsWord(It.IsAny<string>())).Returns(true);
            helperMock.Setup(h => h.LettersNear(It.IsAny<char>())).Returns(new List<char>(){'a','b','c'});

            var target = new NearbyWords(helperMock.Object);

            //act
            var result = target.GetWords("abc");

            //assert
            result.Count().ShouldEqual(27);
        }