コード例 #1
0
ファイル: ColorTest.cs プロジェクト: MykolaKovalchuk/SAE5
        public void TestClone()
        {
            AssertColor(new Color(0x12345678).Clone(), 0x12, 0x34, 0x56, 0x78, 0x12345678);

            Color color = new Color(1);

            color.AddOccurrence(0);
            color.AddOccurrence(1);

            Color clonedColor = color.Clone();

            Assert.AreEqual(2, color.OccurrencesCount);
            Assert.AreEqual(0, clonedColor.OccurrencesCount);
        }
コード例 #2
0
ファイル: ColorTest.cs プロジェクト: MykolaKovalchuk/SAE5
        public void TestUsageOccurrences()
        {
            Color testColor = new Color(0x12345678);

            Assert.AreEqual(0, testColor.OccurrencesCount);

            testColor.AddOccurrence(1);
            testColor.AddOccurrence(2);
            testColor.AddOccurrence(1);
            Assert.AreEqual(3, testColor.OccurrencesCount);

            testColor.RemoveOccurrence(1);
            Assert.AreEqual(2, testColor.OccurrencesCount);

            testColor.ClearOccurrences();
            Assert.AreEqual(0, testColor.OccurrencesCount);
        }