/// <summary> /// Determines the writing speed /// </summary> public static void WriteSpeedName() { Stopwatch crono = new Stopwatch(); Console.WriteLine("Type your name?"); crono.Start(); string name = Console.ReadLine(); crono.Stop(); double time = crono.ElapsedMilliseconds / 1000.0; // define actual write speed WriteSpeedType writeSpeed = WriteSpeed(name, time); if (writeSpeed == WriteSpeedType.SLOW) { Console.WriteLine("You are slow"); } else if (writeSpeed == WriteSpeedType.REGULAR) { Console.WriteLine("You are regular"); } else if (writeSpeed == WriteSpeedType.FAST) { Console.WriteLine("You are fast"); } else { throw new ArgumentException("Unknown writing speed"); } }
//Change write speed (if the current writer is different to "instant") public void SetWriteSpeed(WriteSpeedType writeSpeed) { if (_isTalking) { _writerControl.Writer.SetWriteTypeSpeed(writeSpeed); } else { Debug.LogError("Not talking!"); } }
public void WorksForLowName() { WriteSpeedType lowSpeed = Week3.WriteSpeed("tuti", 10); Assert.AreEqual(lowSpeed, WriteSpeedType.SLOW); }
public void WorksForRegularName() { WriteSpeedType regularSpeed = Week3.WriteSpeed("made", 2); Assert.AreEqual(regularSpeed, WriteSpeedType.REGULAR); }
public void WorksForFastName() { WriteSpeedType fastSpeed = Week3.WriteSpeed("pepe", 1); Assert.AreEqual(WriteSpeedType.FAST, fastSpeed); }