Ejemplo n.º 1
0
        public void Test_IComparable()
        {
            MagickColor first = new MagickColor(MagickColors.White);

            Assert.AreEqual(0, first.CompareTo(first));
            Assert.AreEqual(1, first.CompareTo(null));
            Assert.IsFalse(first < null);
            Assert.IsFalse(first <= null);
            Assert.IsTrue(first > null);
            Assert.IsTrue(first >= null);
            Assert.IsTrue(null < first);
            Assert.IsTrue(null <= first);
            Assert.IsFalse(null > first);
            Assert.IsFalse(null >= first);

            MagickColor second = new MagickColor(MagickColors.Black);

            Assert.AreEqual(1, first.CompareTo(second));
            Assert.IsFalse(first < second);
            Assert.IsFalse(first <= second);
            Assert.IsTrue(first > second);
            Assert.IsTrue(first >= second);

            second = new MagickColor(MagickColors.White);

            Assert.AreEqual(0, first.CompareTo(second));
            Assert.IsFalse(first < second);
            Assert.IsTrue(first <= second);
            Assert.IsFalse(first > second);
            Assert.IsTrue(first >= second);
        }
Ejemplo n.º 2
0
        public void Test_IComparable()
        {
            MagickColor first = new MagickColor(MagickColors.White);

            Assert.AreEqual(0, first.CompareTo(first));
            Assert.AreEqual(1, first.CompareTo(null));
            Assert.IsFalse(first < null);
            Assert.IsFalse(first <= null);
            Assert.IsTrue(first > null);
            Assert.IsTrue(first >= null);
            Assert.IsTrue(null < first);
            Assert.IsTrue(null <= first);
            Assert.IsFalse(null > first);
            Assert.IsFalse(null >= first);

            MagickColor second = new MagickColor(MagickColors.Black);

            Assert.AreEqual(1, first.CompareTo(second));
            Assert.IsFalse(first < second);
            Assert.IsFalse(first <= second);
            Assert.IsTrue(first > second);
            Assert.IsTrue(first >= second);

            second = new MagickColor(MagickColors.White);

            Assert.AreEqual(0, first.CompareTo(second));
            Assert.IsFalse(first < second);
            Assert.IsTrue(first <= second);
            Assert.IsFalse(first > second);
            Assert.IsTrue(first >= second);

            second = MagickColors.White.Clone();
            Assert.AreEqual(0, first.CompareTo(second));

            QuantumType half = (QuantumType)(Quantum.Max / 2.0);

            first = new MagickColor(half, half, half, half, half);

            second = new MagickColor(half, 0, half, half, half);
            Assert.AreEqual(1, first.CompareTo(second));

            second = new MagickColor(half, half, Quantum.Max, half, half);
            Assert.AreEqual(-1, first.CompareTo(second));

            second = new MagickColor(half, half, 0, half, half);
            Assert.AreEqual(1, first.CompareTo(second));

            second = new MagickColor(half, half, half, Quantum.Max, half);
            Assert.AreEqual(-1, first.CompareTo(second));

            second = new MagickColor(half, half, half, 0, half);
            Assert.AreEqual(1, first.CompareTo(second));

            second = new MagickColor(half, half, half, half, Quantum.Max);
            Assert.AreEqual(-1, first.CompareTo(second));

            second = new MagickColor(half, half, half, half, 0);
            Assert.AreEqual(1, first.CompareTo(second));
        }
Ejemplo n.º 3
0
            public void ShouldReturnMinusOneWhenValueIsHigher()
            {
                var half  = (QuantumType)(Quantum.Max / 2.0);
                var first = new MagickColor(half, half, half, half, half);

                var second = new MagickColor(half, half, Quantum.Max, half, half);

                Assert.Equal(-1, first.CompareTo(second));

                second = new MagickColor(half, half, Quantum.Max, half, half);
                Assert.Equal(-1, first.CompareTo(second));

                second = new MagickColor(half, half, half, Quantum.Max, half);
                Assert.Equal(-1, first.CompareTo(second));

                second = new MagickColor(half, half, half, half, Quantum.Max);
                Assert.Equal(-1, first.CompareTo(second));
            }
		public void Test_IComparable()
		{
			MagickColor first = new MagickColor(Color.White);

			Assert.AreEqual(0, first.CompareTo(first));
			Assert.AreEqual(1, first.CompareTo(null));
			Assert.IsFalse(first < null);
			Assert.IsFalse(first <= null);
			Assert.IsTrue(first > null);
			Assert.IsTrue(first >= null);
			Assert.IsTrue(null < first);
			Assert.IsTrue(null <= first);
			Assert.IsFalse(null > first);
			Assert.IsFalse(null >= first);

			MagickColor second = new MagickColor(Color.Black);

			Assert.AreEqual(1, first.CompareTo(second));
			Assert.IsFalse(first < second);
			Assert.IsFalse(first <= second);
			Assert.IsTrue(first > second);
			Assert.IsTrue(first >= second);

			second = new MagickColor(Color.White);

			Assert.AreEqual(0, first.CompareTo(second));
			Assert.IsFalse(first < second);
			Assert.IsTrue(first <= second);
			Assert.IsFalse(first > second);
			Assert.IsTrue(first >= second);
		}