public void TypingStatsConstructorTest() { var target = new TypingStats_Accessor(); Assert.IsNotNull(target); Assert.IsNotNull(target.stopWatch); }
public void GetAcuracyTest2() { var target = new TypingStats_Accessor { ErrorCount = 0, KeyCount = 12 }; const int expected = 100; int actual = target.GetAccuracy(); Assert.AreEqual(expected, actual); }
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); }