I have the following 2 tests (see code below)
The first test works fine CanQUeryDBNoParams,
However, the second test CanQueryDBWithParams
fails with the following error which I have unsuccessfuly tried to google for help with to no avail, so any help with this would be greatly appreciated.
I am using the latest .net from nuget against the lastest OrientDB running on windows 10, as the first test works I know the code and database works.
error:
Test Name: CanQueryDBWithParams
Test FullName: UnitTestTVGraphDB.UnitTestTVGraphDB.CanQueryDBWithParams
Test Source: E:\TVMercurialSCM\johnc\Source\TicketVoodooGraphDB\UnitTestTVGraphDB\UnitTestTVGraphDB.cs : line 91
Test Outcome: Failed
Test Duration: 0:00:00.0297952
Result StackTrace:
at Orient.Client.Protocol.Response.Receive()
at Orient.Client.Protocol.Connection.ExecuteOperationInternal(IOperation operation)
at Orient.Client.Protocol.Connection.ExecuteOperation(IOperation operation)
at Orient.Client.API.Query.PreparedQuery.RunInternal()
at Orient.Client.API.Query.PreparedQuery.Run(String[] properties)
at UnitTestTVGraphDB.UnitTestTVGraphDB.CanQueryDBWithParams() in E:\TVMercurialSCM\johnc\Source\TicketVoodooGraphDB\UnitTestTVGraphDB\UnitTestTVGraphDB.cs:line 106
Result Message:
Test method UnitTestTVGraphDB.UnitTestTVGraphDB.CanQueryDBWithParams threw exception:
Orient.Client.OException: com.orientechnologies.orient.core.exception.OSerializationException: Error on unmarshalling content. Class: q
DB name="VehicleHistoryGraph"
java.lang.ArrayIndexOutOfBoundsException:
[TestMethod]
public void CanQueryDBNoParams()
{
using (GraphDbContext dbContext = new GraphDbContext())
{
using (ODatabase database = new ODatabase(GraphDbConnection.DatabaseAlias))
{
List<ODocument> result = database
.Select("firstName").As("firstName")
.Also("lastName").As("lastName")
.Also("fullName").As("fullName")
.Also("gender").As("gender")
.Also("birthday").As("birthday")
.From<Person>()
.OrderBy("lastName").Descending()
.ToList();
Assert.IsNotNull(result);
Assert.IsTrue(result.Count > 0);
Console.WriteLine(String.Format("result count:{0}", result.Count));
foreach (var doc in result)
{
Console.WriteLine(String.Format("CanQueryDBNoParams doc.OClassName:{0}", doc.OClassName ));
}
}
}
}
[TestMethod]
public void CanQueryDBWithParams()
{
using (GraphDbContext dbContext = new GraphDbContext())
{
using (ODatabase database = new ODatabase(GraphDbConnection.DatabaseAlias))
{
var query = new PreparedQuery(" SELECT FROM Person WHERE lastName = ? ", "*:0");
var selectedValue = database
.Query(query)
.Run("Murphy")
.ToList();
Assert.IsTrue(selectedValue.Count > 0);
}
}
}