1. Readify
  2. Neo4jClient

Issues

Issue #73 resolved

Where clause not building correctly with Generic Interfaces

Brenton McSweyn
created an issue

Hey Tatham,

I've created an issue from : http://stackoverflow.com/questions/15718916/neo4jclient-where-clause-not-putting-in-parameters

Here is a failing test on the Neo4jClient. The problem appears to be when you pass through an interface through a generic function it doesn't build the where clause correctly. The binary lambda expression comes out as "{(Convert(a).Bar != Convert(b).Bar)}".

interface IFoo
{
    int Bar { get; set; }
}

[Test]
public void ComparePropertiesWithGenericInterface()
{            
    GenericWhereClause<IFoo>();
}

static void GenericWhereClause<TNode>() where TNode : IFoo
{
    var client = Substitute.For<IRawGraphClient>();
    var query = new CypherFluentQuery(client)
        .Where<TNode, TNode>((a, b) => a.Bar != b.Bar)
        .Query;

    Assert.AreEqual("WHERE (a.Bar <> b.Bar)", query.QueryText);
    Assert.AreEqual(0, query.QueryParameters.Count);
}

Comments (4)

  1. Log in to comment