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()); }
public void StopTest() { var target = new TypingStats_Accessor(); target.Start(); target.Stop(); const bool expected = false; bool actual = target.stopWatch.IsRunning; Assert.AreEqual(expected, actual); }
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); }