コード例 #1
0
        public void ColorEquality()
        {
            var c1 = new CommonColor(1, 2, 3, 4, "one");
            var c2 = new CommonColor(1, 2, 3, 4, "two");
            var c3 = new CommonColor(1, 2, 3, 5, "three");
            var c4 = new CommonColor(5, 6, 7, 4, "four");

            Assert.That(c1 == c2, Is.True);
            Assert.That(c1 != c2, Is.False);
            Assert.That(c1.Equals(c2), Is.True);
            Assert.That(c1.Equals(c3), Is.False);
            Assert.That(c1.Equals(c3, true), Is.True);
            Assert.That(c1.Equals(c4), Is.False);
        }
コード例 #2
0
        private static CommonColor GetNewRandomScaledColor(Random rand, MaterialColorScale scale, CommonColor oldColor)
        {
            CommonColor newAccent = scale.Colors[rand.Next(scale.Colors.Count)];

            while (newAccent.Equals(oldColor, true))
            {
                newAccent = scale.Colors[rand.Next(scale.Colors.Count)];
            }
            return(newAccent);
        }
コード例 #3
0
        private static CommonColor GetNewRandomColor(Random rand, CommonColor oldColor)
        {
            CommonColor newColor = rand.NextColor();

            while (newColor.Equals(oldColor, true))
            {
                newColor = rand.NextColor();
            }
            return(newColor);
        }