Exemple #1
0
        public void StringFormatTest()
        {
            Time2  strgFormat     = new Time2(20, 35, 59);
            string strgFormatCopy = "20:35:59";

            Assert.AreEqual(strgFormatCopy, strgFormat.ToUniversalString());
        }
Exemple #2
0
        public void NegativeToStringTest2()
        {
            Time2  strgFormat     = new Time2(13, 35, 59);
            string strgFormatCopy = "13:35:59 AM";

            Assert.AreNotEqual(strgFormatCopy, strgFormat.ToUniversalString());
        }
Exemple #3
0
        public void NegativeToStringTest()
        {
            Time2  strgFormat     = new Time2(9, 35, 59);
            string strgFormatCopy = "9:35:59 PM";

            Assert.AreNotEqual(strgFormatCopy, strgFormat.ToString());
        }
Exemple #4
0
        public void ToStringTest()
        {
            Time2  strgFormat     = new Time2(9, 35, 59);
            string strgFormatCopy = "9:35:59 AM";

            Assert.AreEqual(strgFormatCopy, strgFormat.ToString());
        }
Exemple #5
0
        public void PositiveSecondTest()
        {
            Time2 scnd = new Time2(0, 29, 58);

            Assert.AreEqual(58, scnd.Second);
            Time2 scnd2 = new Time2(0, 29, 58);

            Assert.AreNotEqual(50, scnd2.Second);
        }
Exemple #6
0
        public void PositiveMinuteTest()
        {
            Time2 mnt = new Time2(2, 59, 59);

            Assert.AreEqual(59, mnt.Minute);
            Time2 mnt2 = new Time2(2, 59, 59);

            Assert.AreNotEqual(50, mnt2.Minute);
        }
Exemple #7
0
        public void PositiveHourTest()
        {
            Time2 hr = new Time2(20, 59, 59);

            Assert.AreEqual(20, hr.Hour);
            Time2 hr2 = new Time2(20, 59, 59);

            Assert.AreNotEqual(24, hr2.Hour);
        }
Exemple #8
0
 public void NegativeHourTest()
 {
     try
     {
         Time2 hr = new Time2(24, 59, 59);
     }
     catch (System.Exception)
     { }
     finally { Console.WriteLine("out of range"); }
 }
Exemple #9
0
 public void NegativeSecondTest()
 {
     try
     {
         Time2 scnd = new Time2(0, 29, -1);
     }
     catch (System.Exception)
     { }
     finally {
         Console.WriteLine("out of range");
     }
 }
Exemple #10
0
 public void NegativeMinuteTest()
 {
     try
     {
         Time2 mnt = new Time2(2, -1, 59);
     }
     catch (System.Exception)
     { }
     finally {
         Console.WriteLine("out of range");
     }
 }
Exemple #11
0
        static void Main(string[] args)
        {
            int hour   = 0;
            int minute = 0;
            int second = 0;

            hour   = Console.Read();
            minute = Console.Read();
            second = Console.Read();

            Time2 time = new Time2(hour, minute, second);
        }
Exemple #12
0
 // Time2 constructor: another Time2 object supplied as an argument
 public Time2(Time2 time)
     : this(time.Hour, time.Minute, time.Second)
 {
 }