public static void Main() { Console.WriteLine("Give me a word to score."); string input = Console.ReadLine().ToUpper(); ScrabbleScorer newScorer = new ScrabbleScorer(input); newScorer.ScoreWord(); }
public HomeModule() { Get["/"] = _ => { return(View["index.cshtml"]); }; Post["/score"] = _ => { ScrabbleScorer newScrabbleScorer = new ScrabbleScorer(Request.Form["user-word"]); int score = newScrabbleScorer.GetScore(); return(View["index.cshtml", score]); }; }
public static void Main() { Console.WriteLine("Enter a word to score:"); string myString = Console.ReadLine(); if (ScrabbleScorer.Validate(myString)) { int myScore = ScrabbleScorer.Score(myString); Console.WriteLine("Score: " + myScore); } else { Console.WriteLine("Invalid string (contains non-alphabetic characters)"); } }
public void ScrabbleScorerTest1_SingleLetter_True() { ScrabbleScorer testScrabbleScorer = new ScrabbleScorer("p"); Assert.Equal(3, testScrabbleScorer.GetScore()); }
public void ScrabbleScorerTest2_WholeWord_True() { ScrabbleScorer testScrabbleScorer = new ScrabbleScorer("cat"); Assert.Equal(5, testScrabbleScorer.GetScore()); }