Ejemplo n.º 1
0
        public static void Main()
        {
            Console.WriteLine("Give me a word to score.");
            string         input     = Console.ReadLine().ToUpper();
            ScrabbleScorer newScorer = new ScrabbleScorer(input);

            newScorer.ScoreWord();
        }
Ejemplo n.º 2
0
        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]);
            };
        }
Ejemplo n.º 3
0
        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)");
            }
        }
Ejemplo n.º 4
0
        public void ScrabbleScorerTest1_SingleLetter_True()
        {
            ScrabbleScorer testScrabbleScorer = new ScrabbleScorer("p");

            Assert.Equal(3, testScrabbleScorer.GetScore());
        }
Ejemplo n.º 5
0
        public void ScrabbleScorerTest2_WholeWord_True()
        {
            ScrabbleScorer testScrabbleScorer = new ScrabbleScorer("cat");

            Assert.Equal(5, testScrabbleScorer.GetScore());
        }