Exemplo n.º 1
0
        public void AntecedentTest()
        {
            var a1 = new Antecedent(0, ComparisonKind.Equal, 1.0);
            var a2 = new Antecedent(1, ComparisonKind.Equal, 1.0);

            var a3 = new Antecedent(0, ComparisonKind.Equal, 0.0);
            var a4 = new Antecedent(0, ComparisonKind.Equal, 1.0);

            bool a12 = a1.Equals(a2);
            bool a34 = a3.Equals(a4);
            bool a14 = a1.Equals(a4);

            Assert.IsFalse(a12);
            Assert.IsFalse(a34);
            Assert.IsTrue(a14);

            int hash1 = a1.GetHashCode();
            int hash2 = a2.GetHashCode();
            int hash3 = a3.GetHashCode();
            int hash4 = a4.GetHashCode();

            Assert.AreNotEqual(hash1, hash2);
            Assert.AreNotEqual(hash3, hash4);
            Assert.AreEqual(hash1, hash4);
        }
Exemplo n.º 2
0
        public void AntecedentTest()
        {
            var a1 = new Antecedent(0, ComparisonKind.Equal, 1.0);
            var a2 = new Antecedent(1, ComparisonKind.Equal, 1.0);

            var a3 = new Antecedent(0, ComparisonKind.Equal, 0.0);
            var a4 = new Antecedent(0, ComparisonKind.Equal, 1.0);

            bool a12 = a1.Equals(a2);
            bool a34 = a3.Equals(a4);
            bool a14 = a1.Equals(a4);

            Assert.IsFalse(a12);
            Assert.IsFalse(a34);
            Assert.IsTrue(a14);

            int hash1 = a1.GetHashCode();
            int hash2 = a2.GetHashCode();
            int hash3 = a3.GetHashCode();
            int hash4 = a4.GetHashCode();

            Assert.AreNotEqual(hash1, hash2);
            Assert.AreNotEqual(hash3, hash4);
            Assert.AreEqual(hash1, hash4);
        }