예제 #1
0
        /// <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");
            }
        }
예제 #2
0
파일: UTalk.cs 프로젝트: reynarzz/UTalk
 //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!");
     }
 }
예제 #3
0
        public void WorksForLowName()
        {
            WriteSpeedType lowSpeed = Week3.WriteSpeed("tuti", 10);

            Assert.AreEqual(lowSpeed, WriteSpeedType.SLOW);
        }
예제 #4
0
        public void WorksForRegularName()
        {
            WriteSpeedType regularSpeed = Week3.WriteSpeed("made", 2);

            Assert.AreEqual(regularSpeed, WriteSpeedType.REGULAR);
        }
예제 #5
0
        public void WorksForFastName()
        {
            WriteSpeedType fastSpeed = Week3.WriteSpeed("pepe", 1);

            Assert.AreEqual(WriteSpeedType.FAST, fastSpeed);
        }