コード例 #1
0
        public void Different_Objects_Are_Not_Equal()
        {
            var parameters = new { Id = 10 };

            QueryObject queryObject  = new QueryObject(Text, parameters, CommandType);
            QueryObject queryObject2 = new QueryObject("text", parameters, CommandType);
            QueryObject queryObject3 = new QueryObject(Text, null, CommandType);
            QueryObject queryObject4 = new QueryObject(Text, parameters, null);

            Assert.That(queryObject.Equals(queryObject2), Is.False);
            Assert.That(queryObject.Equals(queryObject3), Is.False);
            Assert.That(queryObject.Equals(queryObject4), Is.False);
            Assert.That(queryObject.GetHashCode() == queryObject2.GetHashCode(), Is.False);
            Assert.That(queryObject.GetHashCode() == queryObject3.GetHashCode(), Is.False);
            Assert.That(queryObject.GetHashCode() == queryObject4.GetHashCode(), Is.False);
        }
コード例 #2
0
        public void Same_Objects_Are_Equal()
        {
            var parameters = new { Id = 10 };

            QueryObject queryObject  = new QueryObject(Text, parameters, CommandType);
            QueryObject queryObject2 = new QueryObject(Text, parameters, CommandType);

            Assert.That(queryObject.Equals(queryObject), Is.True);
            Assert.That(queryObject.Equals(queryObject2), Is.True);
            Assert.That(queryObject.GetHashCode() == queryObject2.GetHashCode(), Is.True);
        }