Esempio n. 1
0
        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();
        }
Esempio n. 2
0
        public void Add_TheHourAndMinutes_NegativeValues_FormatException(string time)
        {
            // Arrange
            TimeConvert convert = new TimeConvert();

            // Act
            Assert.Throws <FormatException>(() => convert.Convert(time));
        }
Esempio n. 3
0
        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);
        }