static void Main(string[] args) { try { while (true) { TimeConvert convert = new TimeConvert(); Console.Write("Enter the hour and minutes in the format hh:mm (hour:minutes) : "); string time = Convert.ToString(Console.ReadLine()); var result = convert.Convert(time); Console.WriteLine("{0}\u00B0", result); Console.WriteLine("---------"); } } catch (Exception e) { Console.WriteLine(e.Message); } Console.WriteLine("Press Enter to exit."); Console.Read(); }
public void Add_TheHourAndMinutes_NegativeValues_FormatException(string time) { // Arrange TimeConvert convert = new TimeConvert(); // Act Assert.Throws <FormatException>(() => convert.Convert(time)); }
public void Add_TheHourAndMinutes_PositiveValues(double expected, string time) { // Arrange TimeConvert convert = new TimeConvert(); // Act var result = convert.Convert(time); // Assert Assert.AreEqual(expected, result); }