public override int GetHashCode()
 {
     unchecked
     {
         return((ImageGetHashCode(_source) * 397) ^ _repeatBehavior.GetHashCode());
     }
 }
Esempio n. 2
0
        public void Equals_Object_ReturnsExpected(RepeatBehavior repeatBehaviour, object other, bool expected)
        {
            Assert.Equal(expected, repeatBehaviour.Equals(other));
            if (other is RepeatBehavior otherRepeatBehaviour)
            {
                Assert.Equal(expected, RepeatBehavior.Equals(repeatBehaviour, otherRepeatBehaviour));
                Assert.Equal(expected, repeatBehaviour.Equals(otherRepeatBehaviour));
                Assert.Equal(expected, repeatBehaviour == otherRepeatBehaviour);
                Assert.Equal(!expected, repeatBehaviour != otherRepeatBehaviour);

                if (repeatBehaviour.Type >= RepeatBehaviorType.Count && repeatBehaviour.Type <= RepeatBehaviorType.Forever)
                {
                    Assert.Equal(expected, repeatBehaviour.GetHashCode().Equals(otherRepeatBehaviour.GetHashCode()));
                }
                else if (repeatBehaviour.Type == otherRepeatBehaviour.Type)
                {
                    Assert.Equal(repeatBehaviour.GetHashCode(), otherRepeatBehaviour.GetHashCode());
                }
            }
        }
Esempio n. 3
0
        public void Ctor_TimeSpan(int seconds)
        {
            var repeatBehaviour = new RepeatBehavior(TimeSpan.FromSeconds(seconds));

            Assert.False(repeatBehaviour.HasCount);
            Assert.Equal(0, repeatBehaviour.Count);

            Assert.True(repeatBehaviour.HasDuration);
            Assert.Equal(TimeSpan.FromSeconds(seconds), repeatBehaviour.Duration);

            Assert.Equal(RepeatBehaviorType.Duration, repeatBehaviour.Type);
            Assert.Equal(TimeSpan.FromSeconds(seconds).GetHashCode(), repeatBehaviour.GetHashCode());
        }
Esempio n. 4
0
        public void Ctor_Count(double count)
        {
            var repeatBehaviour = new RepeatBehavior(count);

            Assert.True(repeatBehaviour.HasCount);
            Assert.Equal(count, repeatBehaviour.Count);

            Assert.False(repeatBehaviour.HasDuration);
            Assert.Equal(TimeSpan.Zero, repeatBehaviour.Duration);

            Assert.Equal(RepeatBehaviorType.Count, repeatBehaviour.Type);
            Assert.Equal(count.GetHashCode(), repeatBehaviour.GetHashCode());
        }
Esempio n. 5
0
        public void Forever_Get_ReturnsExpected()
        {
            RepeatBehavior forever = RepeatBehavior.Forever;

            Assert.False(forever.HasCount);
            Assert.Equal(0, forever.Count);

            Assert.False(forever.HasDuration);
            Assert.Equal(TimeSpan.Zero, forever.Duration);

            Assert.Equal(RepeatBehaviorType.Forever, forever.Type);

            Assert.Equal(int.MaxValue - 42, forever.GetHashCode());
        }