public void PrecedenceSupportsEquals()
        {
            Precedence first = new Precedence {
                Association = Association.LeftToRight, Level = 1
            };
            Precedence second = new Precedence {
                Association = Association.LeftToRight, Level = 1
            };
            Precedence third = new Precedence {
                Association = Association.LeftToRight, Level = 2
            };
            Precedence fourth = new Precedence {
                Association = Association.RightToLeft, Level = 2
            };

            object fifth = null;
            object sixth = new Precedence {
                Association = Association.RightToLeft, Level = 2
            };

            Assert.IsTrue(first.Equals(second));
            Assert.IsFalse(second.Equals(third));
            Assert.IsFalse(third.Equals(fourth));
            Assert.IsFalse(fourth.Equals(fifth));
            Assert.IsTrue(fourth.Equals(sixth));

            Assert.IsTrue(first == second);
            Assert.IsFalse(first != second);
        }
 /// <summary>
 /// Two DnsResourceDataIpSecKey are equal iff their precedence, gateway, algorithm and public key fields are equal.
 /// </summary>
 public bool Equals(DnsResourceDataIpSecKey other)
 {
     return(other != null &&
            Precedence.Equals(other.Precedence) &&
            Gateway.Equals(other.Gateway) &&
            Algorithm.Equals(other.Algorithm) &&
            PublicKey.Equals(other.PublicKey));
 }
Example #3
0
        public Type GetInferredType(IMessageHeaders headers)
        {
            if (HasInferredTypeHeader(headers) && Precedence.Equals(TypePrecedence.INFERRED))
            {
                return(FromInferredTypeHeader(headers));
            }

            return(null);
        }
        public void PrecedenceSupportsEquals()
        {
            Precedence first = new Precedence { Association = Association.LeftToRight, Level = 1 };
            Precedence second = new Precedence { Association = Association.LeftToRight, Level = 1 };
            Precedence third = new Precedence { Association = Association.LeftToRight, Level = 2 };
            Precedence fourth = new Precedence { Association = Association.RightToLeft, Level = 2 };

            object fifth = null;
            object sixth = new Precedence {Association = Association.RightToLeft, Level = 2};

            Assert.IsTrue(first.Equals(second));
            Assert.IsFalse(second.Equals(third));
            Assert.IsFalse(third.Equals(fourth));
            Assert.IsFalse(fourth.Equals(fifth));
            Assert.IsTrue(fourth.Equals(sixth));

            Assert.IsTrue(first == second);
            Assert.IsFalse(first != second);
        }