Exemple #1
0
        public StatisticsModel(GivenWordsModel words, PlayerModel player, double time)
        {
            GameCalculator gameCalculator = new GameCalculator();

            CorrectWords  = gameCalculator.CalculateCorrectWords(words.GetWords(), player.GetPlayerWords());
            ErrorCount    = gameCalculator.CalculateErrors(words.GetWords(), player.GetPlayerWords());
            NumberOfChars = gameCalculator.CalculateNumberOfChars(words.GetWords());
            NetWpm        = gameCalculator.CalculateNetWpm(NumberOfChars, ErrorCount, time);
        }
        public void CalculateNumberOfCharsTest()
        {
            //Arrange
            GameCalculator gameCalculator = new GameCalculator();
            int            expectedValue  = 10;

            string[] words =
            {
                "My",
                "Name",
                "Is",
                "Jeff"
            };

            //Act
            int actualValue = gameCalculator.CalculateNumberOfChars(words);

            //Assert
            Assert.AreEqual(expectedValue, actualValue);
        }