Exemplo n.º 1
0
        public void Should_own_a_HashCode(double value)
        {
            var expected = value.GetHashCode();

            var instance = new Millisecond(value);
            var actual   = instance.GetHashCode();

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 2
0
        public override int GetHashCode()
        {
            const int k = 16777619;

            unchecked
            {
                int h = (int)2166136261;
                h = (h * k) ^ Year.GetHashCode();
                h = (h * k) ^ Month.GetHashCode();
                h = (h * k) ^ Day.GetHashCode();
                h = (h * k) ^ Hour.GetHashCode();
                h = (h * k) ^ Minute.GetHashCode();
                h = (h * k) ^ Second.GetHashCode();
                h = (h * k) ^ Millisecond.GetHashCode();
                h = (h * k) ^ IsSubstitued.GetHashCode();
                h = (h * k) ^ IsSummerTime.GetHashCode();
                return(h);
            }
        }
Exemplo n.º 3
0
        public override int GetHashCode()
        {
            var hashCode = 844321305;

            hashCode = hashCode * -1521134295 + Ticks.GetHashCode();
            hashCode = hashCode * -1521134295 + Second.GetHashCode();
            hashCode = hashCode * -1521134295 + Date.GetHashCode();
            hashCode = hashCode * -1521134295 + Month.GetHashCode();
            hashCode = hashCode * -1521134295 + Minute.GetHashCode();
            hashCode = hashCode * -1521134295 + Millisecond.GetHashCode();
            hashCode = hashCode * -1521134295 + Hour.GetHashCode();
            hashCode = hashCode * -1521134295 + DayOfYear.GetHashCode();
            hashCode = hashCode * -1521134295 + DayOfWeek.GetHashCode();
            hashCode = hashCode * -1521134295 + Day.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <TimeSpan> .Default.GetHashCode(TimeOfDay);

            hashCode = hashCode * -1521134295 + Year.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <TimeSpan> .Default.GetHashCode(Offset);

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Value);

            return(hashCode);
        }