public IActionResult Task3Result(string inputString)
        {
            if (String.IsNullOrWhiteSpace(inputString))
            {
                return(BadRequest("Входная трока не может быть пустой"));
            }
            string result  = String.Empty;
            var    counter = new CharactersCounter();

            try
            {
                if (counter.TryGetMissedCharacter(inputString.ToCharArray(), out var missedCharacter))
                {
                    result += "Пропущенная буква: " + missedCharacter;
                }
                else
                {
                    result = "Пропущенная буква не найдена";
                }
            }
            catch (ArgumentOutOfRangeException)
            {
                result = "Входная строка не должна содержать символов кроме букв английского алфавита";
            }
            return(Ok(result));
        }
예제 #2
0
 public void Count_Set_1()
 {
     Assert.AreEqual("11100000000000000000000000000000000000", CharactersCounter.Count("ABC"));
 }
예제 #3
0
 public void Count_numbers()
 {
     Assert.AreEqual("00000000000000000000000000001111111111", CharactersCounter.Count("1234567890"));
 }
예제 #4
0
 public void Count_single_quote()
 {
     Assert.AreEqual("00000000000000000000000000010000000000", CharactersCounter.Count("\'"));
 }
예제 #5
0
 public void Count_hyphen()
 {
     Assert.AreEqual("00000000000000000000000000100000000000", CharactersCounter.Count("-"));
 }
예제 #6
0
 public void Count_Case_Insensitive()
 {
     Assert.AreEqual("01113000000010000100000000000000000000", CharactersCounter.Count("DECEMBER"));
 }
예제 #7
0
 public void Count_Set_3()
 {
     Assert.AreEqual("01113000000010000100000000000000000000", CharactersCounter.Count("December"));
 }