public override bool Equals(object obj) { LambdaExpressionFingerprint other = obj as LambdaExpressionFingerprint; return((other != null) && this.Equals(other)); }
public void Properties() { // Arrange ExpressionType expectedNodeType = ExpressionType.Lambda; Type expectedType = typeof(Action<object>); // Act LambdaExpressionFingerprint fingerprint = new LambdaExpressionFingerprint(expectedNodeType, expectedType); // Assert Assert.AreEqual(expectedNodeType, fingerprint.NodeType); Assert.AreEqual(expectedType, fingerprint.Type); }
public void Comparison_Inequality_NodeType() { // Arrange ExpressionType nodeType = ExpressionType.Lambda; Type type = typeof(Action<object>); // Act LambdaExpressionFingerprint fingerprint1 = new LambdaExpressionFingerprint(nodeType, type); LambdaExpressionFingerprint fingerprint2 = new LambdaExpressionFingerprint(nodeType, typeof(Action)); // Assert Assert.AreNotEqual(fingerprint1, fingerprint2, "Fingerprints should not have been equal (differ by Type)."); }
public void Comparison_Equality() { // Arrange ExpressionType nodeType = ExpressionType.Lambda; Type type = typeof(Action<object>); // Act LambdaExpressionFingerprint fingerprint1 = new LambdaExpressionFingerprint(nodeType, type); LambdaExpressionFingerprint fingerprint2 = new LambdaExpressionFingerprint(nodeType, type); // Assert Assert.AreEqual(fingerprint1, fingerprint2, "Fingerprints should have been equal."); Assert.AreEqual(fingerprint1.GetHashCode(), fingerprint2.GetHashCode(), "Fingerprints should have been different."); }
public void Comparison_Inequality_NodeType() { // Arrange ExpressionType nodeType = ExpressionType.Lambda; Type type = typeof(Action<object>); // Act LambdaExpressionFingerprint fingerprint1 = new LambdaExpressionFingerprint(nodeType, type); LambdaExpressionFingerprint fingerprint2 = new LambdaExpressionFingerprint(nodeType, typeof(Action)); // Assert Assert.NotEqual(fingerprint1, fingerprint2); }
public void Comparison_Equality() { // Arrange ExpressionType nodeType = ExpressionType.Lambda; Type type = typeof(Action <object>); // Act LambdaExpressionFingerprint fingerprint1 = new LambdaExpressionFingerprint(nodeType, type); LambdaExpressionFingerprint fingerprint2 = new LambdaExpressionFingerprint(nodeType, type); // Assert Assert.AreEqual(fingerprint1, fingerprint2, "Fingerprints should have been equal."); Assert.AreEqual(fingerprint1.GetHashCode(), fingerprint2.GetHashCode(), "Fingerprints should have been different."); }
public void Comparison_Equality() { // Arrange ExpressionType nodeType = ExpressionType.Lambda; Type type = typeof(Action<object>); // Act LambdaExpressionFingerprint fingerprint1 = new LambdaExpressionFingerprint(nodeType, type); LambdaExpressionFingerprint fingerprint2 = new LambdaExpressionFingerprint(nodeType, type); // Assert Assert.Equal(fingerprint1, fingerprint2); Assert.Equal(fingerprint1.GetHashCode(), fingerprint2.GetHashCode()); }