예제 #1
0
        public static void comparison()
        {
            DeserializedElement t1 = new DeserializedElementTest(
                id: 50,
                type: ElementType.GameResource
                );
            DeserializedElement t2 = new DeserializedElementTest(
                id: 50,
                type: ElementType.GameResource
                );
            DeserializedElement t3 = new DeserializedElementTest(
                id: 25,
                type: ElementType.GameResource
                );
            DeserializedElement t4 = new DeserializedElementTest(
                id: 75,
                type: ElementType.GameResource
                );
            DeserializedElement t5 = new DeserializedElementTest(
                id: 50,
                type: ElementType.ClusterType
                );
            DeserializedElement tN = null;

            Assert.Greater(t1.CompareTo(tN), 0);
            Assert.Greater(t1.CompareTo(t3), 0);
            Assert.AreEqual(t1.CompareTo(t2), 0);
            Assert.Less(t1.CompareTo(t4), 0);
            Assert.Less(t1.CompareTo(t5), 0);
        }
예제 #2
0
        public static void init()
        {
            var t1 = new DeserializedElementTest(
                id: 1,
                type: ElementType.AbstractImage
                );

            Assert.AreEqual(1, t1.id);
            Assert.AreEqual(ElementType.AbstractImage, t1.type);
        }
예제 #3
0
        public static void equality()
        {
            DeserializedElement t1 = new DeserializedElementTest(
                id: 1,
                type: ElementType.AbstractImage
                );

            DeserializedElement t2 = new DeserializedElementTest(
                id: 1,
                type: ElementType.AbstractImage
                );

            DeserializedElement t3 = new DeserializedElementTest(
                id: 1,
                type: ElementType.ClusterType
                );

            DeserializedElement t4 = new DeserializedElementTest(
                id: 2,
                type: ElementType.AbstractImage
                );

            DeserializedElement tN = null;

            Assert.AreEqual(t1, t2);
            Assert.AreNotEqual(t1, t3);
            Assert.AreNotEqual(t1, t4);
            Assert.AreNotEqual(t1, tN);

            Assert.That(t1 == t2);
            Assert.That(t1 != t3);
            Assert.That(t1 != t4);
            Assert.That(t1 != tN);

            Assert.That(t2 == t1);
            Assert.That(t3 != t1);
            Assert.That(t4 != t1);
            Assert.That(tN != t1);
        }