public static void AskForWordInput() { Console.WriteLine("Please enter a word containing only letter characters. Multiple words cannot be used."); string userWord = Console.ReadLine(); Scrabble scrabble = new Scrabble(userWord); bool ismultipleWords = scrabble.CheckIfMultipleWords(); if (ismultipleWords) { Error(); AskForWordInput(); } else { bool isScoreZero = scrabble.CheckIfNonLettersOrEmpty(); if (isScoreZero) { Console.WriteLine("Score is equal to 0."); } else { int score = scrabble.CalculateScore(); Console.WriteLine("The score value for your word is:"); Console.WriteLine(score); } } }
public void CalculateScore_ReturnScoreForAllLetters_32() { Scrabble newWord = new Scrabble("quetzalcoatl"); int result = newWord.CalculateScore(); Assert.AreEqual(32, result); }
public void CalculateScore_ReturnScoreForAllLetters_8() { Scrabble newWord = new Scrabble("hello"); int result = newWord.CalculateScore(); Assert.AreEqual(8, result); }
public void CalculateScore_SingleLetter_Number() { //Arrange string oneLetter = "z"; //Act Scrabble newWord = new Scrabble(oneLetter); //Assert Assert.Equal(10, newWord.CalculateScore()); }
public void CalculateScore_MultipleLetters_Number() { //Arrange string multipleLetters = "dog"; //Act Scrabble newWord = new Scrabble(multipleLetters); //Assert Assert.Equal(5, newWord.CalculateScore()); }
public HomeModule() { Get["/"] = _ => { return(View["index.cshtml"]); }; Post["/results"] = _ => { string word = Request.Form["word"]; Scrabble newWord = new Scrabble(word); int result = newWord.CalculateScore(); return(View["index.cshtml", result]); }; Post["/new"] = _ => { return(View["index.cshtml"]); }; }