Exemplo n.º 1
0
        public void StartTest()
        {
            var target = new TypingStats_Accessor();

            target.Start();
            Assert.AreEqual(0, target.KeyCount);
            Assert.AreEqual(0, target.ErrorCount);
            Assert.AreEqual(100, target.GetAccuracy());
            Assert.AreEqual(0, target.GetAverageWpm());
        }
Exemplo n.º 2
0
        public void GetAverageWpmTest()
        {
            var target = new TypingStats_Accessor();

            // Simulate 5 words per second == 300 wpm

            target.Start();
            target.KeyCount = 25;
            Thread.Sleep(1000);
            target.Stop();

            const int expected = 300;
            int       actual   = target.GetAverageWpm();

            Assert.IsTrue((expected - actual) < 5);
        }