Exemple #1
0
        public void AddWord_IfWordRepositoryDoesNotContainSpecifiedWord_ShouldNotCallAddWordAndGiveUserAdditionalSearch()
        {
            _wordRepository.GetWordsDictionary().Returns(new List <string> {
                "test", "vienas"
            });
            _userContract.GetUser("127.0.0.1").Returns(new User {
                Id = 1, UserIp = "127.0.0.1", SearchesLeft = 10
            });

            _dictionaryManagingService.AddWord("test", "127.0.0.1");

            _wordRepository.DidNotReceive().AddWord("test");
            _userManagingService.DidNotReceive().GiveUserAdditionalSearch("127.0.0.1");
        }
Exemple #2
0
        public IActionResult AddWord(string input)
        {
            if (String.IsNullOrEmpty(input))
            {
                return(View());
            }

            _dictionaryManagaingService.AddWord(input, HttpContext.Connection.LocalIpAddress.ToString());

            return(View());
        }