public void ConstructorSetsProperties()
        {
            // Arrange
            Expression expression = Expression.Parameter(typeof(string), "parameter_name");

            // Act
            ExpressionFingerprint fingerprint = new FooExpressionFingerprint(expression);

            // Assert
            Assert.AreEqual(expression.NodeType, fingerprint.NodeType);
            Assert.AreEqual(expression.Type, fingerprint.Type);
        }
        public void EqualsReturnsFalseIfOtherIsNotFingerprint()
        {
            // Arrange
            Expression            expression  = Expression.Parameter(typeof(string), "parameter_name");
            ExpressionFingerprint fingerprint = new FooExpressionFingerprint(expression);

            // Act
            bool equalsValue = fingerprint.Equals(5);

            // Assert
            Assert.IsFalse(equalsValue);
        }
        public void Comparison_EquivalentExpressions() {
            // both fingerprints are FOO:int, so are equivalent

            // Arrange
            ExpressionFingerprint fingerprint1 = new FooExpressionFingerprint(Expression.Constant(0));
            ExpressionFingerprint fingerprint2 = new FooExpressionFingerprint(Expression.Constant(1));

            // Act
            HashSet<ExpressionFingerprint> set = new HashSet<ExpressionFingerprint>(){
                fingerprint1,
                fingerprint2
            };

            // Assert
            Assert.AreEqual(1, set.Count, "Fingerprints should have been equivalent.");
        }
        public void Comparison_DifferByType() {
            // fingerprints are FOO:int and FOO:long, so not equivalent

            // Arrange
            ExpressionFingerprint fingerprint1 = new FooExpressionFingerprint(Expression.Constant(0));
            ExpressionFingerprint fingerprint2 = new FooExpressionFingerprint(Expression.Constant(0L));

            // Act
            HashSet<ExpressionFingerprint> set = new HashSet<ExpressionFingerprint>(){
                fingerprint1,
                fingerprint2
            };

            // Assert
            Assert.AreEqual(2, set.Count, "Fingerprints should not have been equivalent - differ by ExpressionFingerprint.Type.");
        }
        public void Comparison_DifferByNodeType() {
            // fingerprints are FOO:int and PARAM:int, so not equivalent

            // Arrange
            ExpressionFingerprint fingerprint1 = new FooExpressionFingerprint(Expression.Constant(0));
            ExpressionFingerprint fingerprint2 = new FooExpressionFingerprint(Expression.Parameter(typeof(int), null));

            // Act
            HashSet<ExpressionFingerprint> set = new HashSet<ExpressionFingerprint>() {
                fingerprint1,
                fingerprint2
            };

            // Assert
            Assert.AreEqual(2, set.Count, "Fingerprints should not have been equivalent - differ by ExpressionFingerprint.NodeType.");
        }
        public void Comparison_DifferByGetType()
        {
            // fingerprints are FOO:int and BAR:int, so not equivalent

            // Arrange
            ExpressionFingerprint fingerprint1 = new FooExpressionFingerprint(Expression.Constant(0));
            ExpressionFingerprint fingerprint2 = new BarExpressionFingerprint(Expression.Constant(0));

            // Act
            HashSet <ExpressionFingerprint> set = new HashSet <ExpressionFingerprint>()
            {
                fingerprint1,
                fingerprint2
            };

            // Assert
            Assert.AreEqual(2, set.Count, "Fingerprints should not have been equivalent - differ by ExpressionFingerprint.GetType().");
        }
        public void Comparison_EquivalentExpressions()
        {
            // both fingerprints are FOO:int, so are equivalent

            // Arrange
            ExpressionFingerprint fingerprint1 = new FooExpressionFingerprint(Expression.Constant(0));
            ExpressionFingerprint fingerprint2 = new FooExpressionFingerprint(Expression.Constant(1));

            // Act
            HashSet <ExpressionFingerprint> set = new HashSet <ExpressionFingerprint>()
            {
                fingerprint1,
                fingerprint2
            };

            // Assert
            Assert.AreEqual(1, set.Count, "Fingerprints should have been equivalent.");
        }
        public void Comparison_DifferByNodeType()
        {
            // fingerprints are FOO:int and PARAM:int, so not equivalent

            // Arrange
            ExpressionFingerprint fingerprint1 = new FooExpressionFingerprint(Expression.Constant(0));
            ExpressionFingerprint fingerprint2 = new FooExpressionFingerprint(Expression.Parameter(typeof(int), null));

            // Act
            HashSet <ExpressionFingerprint> set = new HashSet <ExpressionFingerprint>()
            {
                fingerprint1,
                fingerprint2
            };

            // Assert
            Assert.AreEqual(2, set.Count, "Fingerprints should not have been equivalent - differ by ExpressionFingerprint.NodeType.");
        }
        public void EqualsReturnsFalseIfOtherIsNotFingerprint() {
            // Arrange
            Expression expression = Expression.Parameter(typeof(string), "parameter_name");
            ExpressionFingerprint fingerprint = new FooExpressionFingerprint(expression);

            // Act
            bool equalsValue = fingerprint.Equals(5);

            // Assert
            Assert.IsFalse(equalsValue);
        }
        public void ConstructorSetsProperties() {
            // Arrange
            Expression expression = Expression.Parameter(typeof(string), "parameter_name");

            // Act
            ExpressionFingerprint fingerprint = new FooExpressionFingerprint(expression);

            // Assert
            Assert.AreEqual(expression.NodeType, fingerprint.NodeType);
            Assert.AreEqual(expression.Type, fingerprint.Type);
        }