public async Task GetWordsBySearchSuccessfully()
        {
            var anagrams = new List <Anagram>()
            {
                new Anagram()
                {
                    Category = "cat", Word = "Word"
                }
            };

            _additionalWordRepoMock.SelectWordsBySearch(Arg.Any <string>()).Returns(
                new List <WordEntity>()
            {
                new WordEntity()
            });
            _mapperMock.Map <List <Anagram> >(Arg.Any <List <WordEntity> >()).Returns(anagrams);

            var result = await _wordService.GetWordsBySearch("phrase");

            await _additionalWordRepoMock.Received().SelectWordsBySearch(Arg.Any <string>());

            _mapperMock.Received().Map <List <Anagram> >(Arg.Any <List <WordEntity> >());
            Assert.AreEqual(anagrams.Count, result.Count);
            Assert.AreEqual(anagrams[0].Word, result[0].Word);
            Assert.AreEqual(anagrams[0].Category, result[0].Category);
        }
        public async Task <List <Anagram> > GetWordsBySearch(string phrase)
        {
            if (string.IsNullOrEmpty(phrase))
            {
                throw new Exception("Cannot find any words, because your phrase is empty");
            }

            var resultEntity = await _additionalWordRepository.SelectWordsBySearch(phrase);

            if (resultEntity == null || resultEntity.Count < 1)
            {
                throw new Exception("No words found");
            }

            var words = _mapper.Map <List <Anagram> >(resultEntity);

            return(words);
        }