Exemple #1
0
        public static void GetHashCodeTest()
        {
            TimeOnly timeOnly1 = TimeOnly.FromDateTime(DateTime.Now);
            TimeOnly timeOnly2 = timeOnly1.Add(new TimeSpan(1));
            TimeOnly timeOnly3 = new TimeOnly(timeOnly1.Ticks);

            Assert.True(timeOnly1.GetHashCode() == timeOnly3.GetHashCode());
            Assert.False(timeOnly1.GetHashCode() == timeOnly2.GetHashCode());
        }