/// <summary> /// Determines which of the three names were written faster /// </summary> /// public static void FastestOfThreeName() { Stopwatch crono = new Stopwatch(); Console.WriteLine("Type your name three times"); crono.Start(); string firstName = Console.ReadLine(); crono.Stop(); long firstTimeName = crono.ElapsedMilliseconds; crono.Restart(); crono.Start(); string secondName = Console.ReadLine(); crono.Stop(); long secondTimeName = crono.ElapsedMilliseconds; crono.Restart(); crono.Start(); string thirdName = Console.ReadLine(); crono.Stop(); long thirdTimeName = crono.ElapsedMilliseconds; crono.Restart(); FastNameType fastestName = FastName(firstName, secondName, thirdName, firstTimeName, secondTimeName, thirdTimeName); if (fastestName == FastNameType.FIRST_NAME_FAST) { Console.WriteLine("You wrote the first name fastest"); } else if (fastestName == FastNameType.SECOND_NAME_FAST) { Console.WriteLine("You wrote the second name fastest"); } else if (fastestName == FastNameType.THIRD_NAME_FAST) { Console.WriteLine("You wrote the third name fastest"); } else { throw new ArgumentException("Unknown name order"); } }
public void WorksForFastFirstSecondThirdNameEqual() { FastNameType firstThirdName = Week3.FastName("tuti", "tuti", "tuti", 1, 1, 1); Assert.AreEqual(firstThirdName, FastNameType.FIRST_NAME_FAST); }
public void WorksForFastFirstSecondNameEqual() { FastNameType thirdName = Week3.FastName("tuti", "tuti", "tuti", 3, 3, 9); Assert.AreEqual(thirdName, FastNameType.FIRST_NAME_FAST); }
public void WorksForFastThirdName() { FastNameType thirdName = Week3.FastName("tuti", "tuti", "tuti", 8, 9, 3); Assert.AreEqual(thirdName, FastNameType.THIRD_NAME_FAST); }
public void WorksForFastSecondName() { FastNameType secondName = Week3.FastName("made", "made", "made", 7, 4, 8); Assert.AreEqual(secondName, FastNameType.SECOND_NAME_FAST); }
public void WorksForFastFirstName() { FastNameType firstName = Week3.FastName("pepe", "pepe", "pepe", 1, 2, 2); Assert.AreEqual(firstName, FastNameType.FIRST_NAME_FAST); }
public void WorksForFastSecondThirdNameEqual() { FastNameType thirdName = Week3.FastName("tuti", "tuti", "tuti", 8, 3, 3); Assert.AreEqual(thirdName, FastNameType.SECOND_NAME_FAST); }