示例#1
0
        public void Make_sure_invalid_recursive_alias_qualifier_throws_properly()
        {
            using (var store = GetDocumentStore())
            {
                Samples.CreateNorthwindDatabase(store);
                using (var session = store.OpenSession())
                {
                    var e = Assert.Throws <InvalidQueryException>(() => session.Advanced.RawQuery <JObject>(@"
                        match (Employees as e)- recursive as r[ (all) { [ReportsTo]->(Employees as m) }
                        select id(e), r[].m
                    ").ToArray());

                    Assert.True(e.Message.Contains("expected", StringComparison.InvariantCultureIgnoreCase));
                    Assert.True(e.Message.Contains("'['", StringComparison.InvariantCultureIgnoreCase));

                    e = Assert.Throws <InvalidQueryException>(() => session.Advanced.RawQuery <JObject>(@"
                        match (Employees as e)- recursive as r] (all) { [ReportsTo]->(Employees as m) }
                        select id(e), r[].m
                    ").ToArray());

                    Assert.True(e.Message.Contains("expected", StringComparison.InvariantCultureIgnoreCase));
                    Assert.True(e.Message.Contains("']'", StringComparison.InvariantCultureIgnoreCase));
                }
            }
        }
示例#2
0
        public void Throws_proper_exception_on_missing_opening_bracket()
        {
            using (var store = GetDocumentStore())
            {
                Samples.CreateNorthwindDatabase(store);
                using (var session = store.OpenSession())
                {
                    var e = Assert.Throws <InvalidQueryException>(() => session.Advanced.RawQuery <JObject>(
                                                                      @"
                           match (Orders as o where id() = 'orders/825-A')-[Lines].Product]->(Products as p)
                        ").ToArray());

                    Assert.True(e.Message.Contains("Lines") && e.Message.Contains("."));

                    var e2 = Assert.Throws <RavenException>(() => session.Advanced.RawQuery <JObject>(
                                                                @"
                           match (Orders as o where id() = 'orders/825-A')-[Lines]]->(Products as p)
                        ").ToArray());


                    Assert.True(e2.Message.Contains("]"));

                    e2 = Assert.Throws <RavenException>(() => session.Advanced.RawQuery <JObject>(
                                                            @"
                           match (Orders as o where id() = 'orders/825-A'))-[Lines]->(Products as p)
                        ").ToArray());

                    Assert.True(e2.Message.Contains(")"));
                }
            }
        }
示例#3
0
        public void Can_query_with_vertices_source_from_map_reduce_index()
        {
            using (var store = GetDocumentStore())
            {
                Samples.CreateNorthwindDatabase(store, Raven.Client.Documents.Smuggler.DatabaseItemType.Documents | Raven.Client.Documents.Smuggler.DatabaseItemType.Indexes);
                Indexes.WaitForIndexing(store);
                using (var session = store.OpenSession())
                {
                    var results = session.Advanced.RawQuery <JObject>(@"
                        with { from index 'Orders/ByCompany' } as o
                        match (o)-[Company]->(Companies as c) 
                    ").ToList();

                    Assert.NotEmpty(results); //sanity check

                    var companiesInIndex = session.Advanced.RawQuery <JObject>(@"from index 'Orders/ByCompany' select Company").ToList();
                    var companyNames     = session.Load <dynamic>(companiesInIndex.Select(x => x["Company"].Value <string>()))
                                           .Select(x => (string)x.Value.Name).ToArray();
                    Assert.Equal(companyNames.Length, results.Count);

                    var companiesFetchedFromGraphQuery = results.Select(x => x["c"]["Name"].Value <string>()).ToArray();
                    foreach (var c in companyNames)
                    {
                        Assert.Contains(c, companiesFetchedFromGraphQuery);
                    }
                }
            }
        }
示例#4
0
        public async Task QueryWithSingleWhereFilteringAndAliasShouldWork()
        {
            const string queryWithSingleWhereCondition = @"select ""_"".""id()"",
    ""_"".""FirstName"",
    ""_"".""LastName"",
    ""_"".""json()""
from
(
    FROM Employees as e WHERE startsWith(e.LastName, 'D') select e.FirstName, e.LastName
) ""_""
where ""_"".""LastName"" = 'Dodsworth' and ""_"".""LastName"" is not null
limit 1000";

            DoNotReuseServer(EnablePostgresSqlSettings);

            using (var store = GetDocumentStore())
            {
                Samples.CreateNorthwindDatabase(store);

                // queryWithSingleReplace

                var result = await Act(store, queryWithSingleWhereCondition, Server);

                DataRowCollection rows = result.Rows;

                Assert.Equal(1, rows.Count);
            }
        }
示例#5
0
        public void Throws_proper_exception_on_invalid_method_call_in_where()
        {
            using (var store = GetDocumentStore())
            {
                Samples.CreateNorthwindDatabase(store);
                using (var session = store.OpenSession())
                {
                    var e = Assert.Throws <InvalidQueryException>(() => session.Advanced.RawQuery <JObject>(
                                                                      @"
                           match (Orders as o where id())-[Lines.Product]->(Products as p)
                        ").ToArray());

                    Assert.True(e.Message.Contains("where") &&
                                e.Message.Contains("id") &&
                                e.Message.Contains("Orders"));

                    e = Assert.Throws <InvalidQueryException>(() => session.Advanced.RawQuery <JObject>(
                                                                  @"
                           match (Orders as o)-[Lines.Product where id()]->(Products as p)
                        ").ToArray());

                    Assert.True(e.Message.Contains("where") &&
                                e.Message.Contains("id") &&
                                e.Message.Contains("Lines.Product"));
                }
            }
        }
示例#6
0
        public void Throws_proper_exception_on_missing_where_clause_condition_expression()
        {
            using (var store = GetDocumentStore())
            {
                Samples.CreateNorthwindDatabase(store);
                using (var session = store.OpenSession())
                {
                    //missing where expression in edge
                    var e = Assert.Throws <InvalidQueryException>(() => session.Advanced.RawQuery <JObject>(
                                                                      @"
                           match (Orders as o where id() = 'orders/825-A')-[Lines.Product where]->(Products as p)
                        ").ToArray());

                    Assert.True(e.Message.Contains("Lines.Product") &&
                                e.Message.Contains("where", StringComparison.OrdinalIgnoreCase) &&
                                e.Message.Contains("filter expression", StringComparison.OrdinalIgnoreCase));

                    //missing where expression in node
                    e = Assert.Throws <InvalidQueryException>(() => session.Advanced.RawQuery <JObject>(
                                                                  @"
                           match (Orders as o where)-[Lines[].Product]->(Products as p)
                        ").ToArray());

                    Assert.True(e.Message.Contains("Orders") &&
                                e.Message.Contains("where", StringComparison.OrdinalIgnoreCase) &&
                                e.Message.Contains("filter expression", StringComparison.OrdinalIgnoreCase));
                }
            }
        }
示例#7
0
        public async Task ForSpecificDatabase_GetCorrectCollectionNames()
        {
            const string postgresQuery =
                "select TABLE_SCHEMA, TABLE_NAME, TABLE_TYPE" +
                "\r\nfrom INFORMATION_SCHEMA.tables" +
                "\r\nwhere TABLE_SCHEMA not in ('information_schema', 'pg_catalog')" +
                "\r\norder by TABLE_SCHEMA, TABLE_NAME";

            DoNotReuseServer(EnablePostgresSqlSettings);

            using (var store = GetDocumentStore())
            {
                Samples.CreateNorthwindDatabase(store);

                var collections = await store.Maintenance
                                  .SendAsync(new GetCollectionStatisticsOperation());

                var result = await Act(store, postgresQuery, Server);

                Assert.NotNull(result);
                Assert.NotEmpty(result.Columns);
                Assert.NotEmpty(result.Rows);

                AssertDatabaseCollections(collections, result);
            }
        }
示例#8
0
        public void Two_non_adjacent_recursive_queries_should_work()
        {
            using (var store = GetDocumentStore())
            {
                Samples.CreateNorthwindDatabase(store);

                using (var session = store.OpenSession())
                {
                    for (int i = 0; i < 10; i++)
                    {
                        var employee = new Employee
                        {
                            ReportsTo = "employees/" + (i + 1)
                        };
                        session.Store(employee, "employees/" + i);
                    }
                    session.SaveChanges();
                }

                using (var session = store.OpenSession())
                {
                    var results = session.Advanced.RawQuery <JObject>(
                        @"match (Employees as e) 
                            -recursive as r1 { [ReportsTo]->(Employees as manager) }-[ReportsTo]->(Employees as finalManager)
                            -recursive as r2 { [ReportsTo]->(Employees as manager2) }").ToList();

                    Assert.Equal(7, results.Count);
                }
            }
        }
示例#9
0
        public async Task NpgQueryWithIntegerParametersShouldWork()
        {
            const string query = "from 'Products' where PricePerUnit > @p";

            DoNotReuseServer(EnablePostgresSqlSettings);

            using (var store = GetDocumentStore())
            {
                Samples.CreateNorthwindDatabase(store);

                using (var session = store.OpenAsyncSession())
                {
                    int pricePerUnitConditionValue = 30;

                    var products = await session.Query <Product>().Where(x => x.PricePerUnit > pricePerUnitConditionValue).ToListAsync();

                    var result = await Act(store, query, Server, parameters : new Dictionary <string, (NpgsqlDbType, object)>()
                    {
                        { "p", (NpgsqlDbType.Integer, pricePerUnitConditionValue) }
                    });

                    Assert.NotNull(result);
                    Assert.NotEmpty(result.Rows);
                    Assert.Equal(products.Count, result.Rows.Count);
                }
            }
        }
示例#10
0
        public async Task CanRecoverSampleData()
        {
            var rootPath      = NewDataPath(prefix: Guid.NewGuid().ToString());
            var badName       = GetDatabaseName();
            var badPath       = Path.Combine(rootPath, badName);
            var recoveredPath = Path.Combine(rootPath, "recovery");

            using (var corruptedStore = GetDocumentStore(
                       new Options
            {
                Path = badPath,
                RunInMemory = false,
                DeleteDatabaseOnDispose = false,
                ModifyDatabaseName = _ => badName
            }))
            {
                Samples.CreateNorthwindDatabase(corruptedStore);
            }

            Assert.True(Server.ServerStore.DatabasesLandlord.UnloadDirectly(badName));

            var recoveryOptions = new RecoveryOptions
            {
                PathToDataFile    = badPath,
                RecoveryDirectory = recoveredPath,
            };

            using (var store = await RecoverDatabase(recoveryOptions))
            {
            }
        }
示例#11
0
        public async Task CanGetCorrectNumberOfRecordAndFieldNameUsingMapReduceIndex()
        {
            const string query = "from index 'Orders/ByCompany'";

            DoNotReuseServer(EnablePostgresSqlSettings);

            using (var store = GetDocumentStore())
            {
                Samples.CreateNorthwindDatabase(store);

                var indexDefinition = new IndexDefinition
                {
                    Name = "Orders/ByCompany",
                    Maps =
                    {
                        @"from order in docs.Orders
select new
{
    order.Company,
    Count = 1,
    Total = order.Lines.Sum(l => (l.Quantity * l.PricePerUnit) * (1 - l.Discount))
}"
                    },
                    Reduce = @"from result in results
group result by result.Company 
into g
select new
{
    Company = g.Key,
    Count = g.Sum(x => x.Count),
    Total = g.Sum(x => x.Total)
}"
                };

                store.Maintenance.Send(new PutIndexesOperation(indexDefinition));
                Indexes.WaitForIndexing(store);

                using (var session = store.OpenAsyncSession())
                {
                    var orders = await session.Advanced
                                 .AsyncRawQuery <JObject>(query)
                                 .ToArrayAsync();

                    var result = await Act(store, query, Server);

                    Assert.NotNull(result);
                    Assert.NotEmpty(result.Rows);
                    Assert.Equal(orders.Length, result.Rows.Count);

                    var columnNames = GetColumnNames(result);

                    Assert.Equal(4, columnNames.Count);
                    Assert.Contains("Company", columnNames);
                    Assert.Contains("Count", columnNames);
                    Assert.Contains("Total", columnNames);
                    Assert.Contains(Constants.Documents.Querying.Fields.PowerBIJsonFieldName, columnNames);
                }
            }
        }
 public void ExecuteIndexAndWaitForUserToContinueTheTest <T>() where T : AbstractIndexCreationTask, new()
 {
     using (var store = GetDocumentStore())
     {
         Samples.CreateNorthwindDatabase(store);
         new T().Execute(store);
         WaitForUserToContinueTheTest(store);
     }
 }
示例#13
0
        public async Task WillGenerateSchemaAndReturnEmptyResponseEvenIfQueryReturnsNoResults()
        {
            const string queryWithSingleWhereCondition = @"select ""_"".""id()"",
    ""_"".""LastName"",
    ""_"".""FirstName"",
    ""_"".""Title"",
    ""_"".""Address"",
    ""_"".""HiredAt"",
    ""_"".""Birthday"",
    ""_"".""HomePhone"",
    ""_"".""Extension"",
    ""_"".""ReportsTo"",
    ""_"".""Notes"",
    ""_"".""Territories"",
    ""_"".""json()""
from 
(
    select ""_"".""id()"",
        ""_"".""LastName"",
        ""_"".""FirstName"",
        ""_"".""Title"",
        ""_"".""Address"",
        ""_"".""HiredAt"",
        ""_"".""Birthday"",
        ""_"".""HomePhone"",
        ""_"".""Extension"",
        ""_"".""ReportsTo"",
        ""_"".""Notes"",
        ""_"".""Territories"",
        ""_"".""json()""
    from 
    (
        from Employees where startsWith(LastName, 'D')
    ) ""_""
    where (""_"".""FirstName"" <> 'Anne' or ""_"".""FirstName"" is null) and (""_"".""FirstName"" <> 'Nancy' or ""_"".""FirstName"" is null)
) ""_""
where (""_"".""FirstName"" <> 'Anne' or ""_"".""FirstName"" is null) and (""_"".""FirstName"" <> 'Nancy' or ""_"".""FirstName"" is null)
limit 1000";

            DoNotReuseServer(EnablePostgresSqlSettings);

            using (var store = GetDocumentStore())
            {
                Samples.CreateNorthwindDatabase(store);

                // queryWithSingleReplace

                var result = await Act(store, queryWithSingleWhereCondition, Server);

                DataRowCollection rows = result.Rows;

                Assert.Equal(0, rows.Count);
            }
        }
示例#14
0
 public void Can_parse_intersections_with_parenthesis()
 {
     using (var store = GetDocumentStore())
     {
         Samples.CreateNorthwindDatabase(store);
         using (var session = store.OpenSession())
         {
             var results = session.Advanced.RawQuery <JObject>("match (((Employees as e1)) or ((Employees as e2))) or (Employees as e3)").ToArray();
             Assert.Equal(900, results.Length);
         }
     }
 }
示例#15
0
 public void Index_query_expression_inside_edge_expressions_should_throw()
 {
     using (var store = GetDocumentStore())
     {
         Samples.CreateNorthwindDatabase(store, Raven.Client.Documents.Smuggler.DatabaseItemType.Documents | Raven.Client.Documents.Smuggler.DatabaseItemType.Indexes);
         Indexes.WaitForIndexing(store);
         using (var session = store.OpenSession())
         {
             //this use-case is a bit silly, but why not throw explicit & informative exception even in such case :)
             Assert.Throws <InvalidQueryException>(() => session.Advanced.RawQuery <JObject>("match (Employee as e)-[index 'Orders/Totals' as o select Employee]->(Employee as anotherE)").ToArray());
         }
     }
 }
示例#16
0
 public void Can_properly_parse_query()
 {
     using (var store = GetDocumentStore())
     {
         Samples.CreateNorthwindDatabase(store);
         using (var session = store.OpenSession())
         {
             var orders  = session.Query <Order>().ToList();
             var results = session.Advanced.RawQuery <Order>("match (Employees as e)<-[Employee]-(Orders as o)-[Company]->(Companies as c) select o").ToArray();
             Assert.Equal(orders, results);
         }
     }
 }
示例#17
0
 public void Select_clause_inside_node_expressions_should_throw()
 {
     using (var store = GetDocumentStore())
     {
         Samples.CreateNorthwindDatabase(store, Raven.Client.Documents.Smuggler.DatabaseItemType.Documents | Raven.Client.Documents.Smuggler.DatabaseItemType.Indexes);
         Indexes.WaitForIndexing(store);
         using (var session = store.OpenSession())
         {
             Assert.Throws <InvalidQueryException>(() => session.Advanced.RawQuery <JObject>("match (index 'Orders/Totals' as o select Employee)").ToArray());
             Assert.Throws <InvalidQueryException>(() => session.Advanced.RawQuery <JObject>("match (Orders as o select Employee)").ToArray());
         }
     }
 }
示例#18
0
 public void SortOnDecimalFieldShouldWork()
 {
     using (var store = GetDocumentStore())
     {
         Samples.CreateNorthwindDatabase(store);
         using (var session = store.OpenSession())
         {
             var result = session.Advanced.RawQuery <Order>(@"
                 match (Orders as o) order by o.Freight as double desc 
             ").First();
             Assert.Equal((decimal)1007.64M, result.Freight);
         }
     }
 }
示例#19
0
        public void Should_implicitly_define_aliases_on_nodes_with_just_collections()
        {
            using (var store = GetDocumentStore())
            {
                Samples.CreateNorthwindDatabase(store);
                using (var session = store.OpenSession())
                {
                    var results = session.Advanced.RawQuery <JObject>(@"match (Employees)-[ReportsTo]->(Employees)").ToArray();

                    Assert.NotEmpty(results);          //sanity check
                    Assert.Equal(4, results[0].Count); // from, edge, to and @metadata
                }
            }
        }
示例#20
0
 public void Should_fail_on_missing_projection_for_single_edge()
 {
     using (var store = GetDocumentStore())
     {
         Samples.CreateNorthwindDatabase(store);
         using (var session = store.OpenSession())
         {
             //the issue was that this query throws NRE at server-side.
             //instead this should throw proper InvalidQueryException
             Assert.Throws <InvalidQueryException>(() => session.Advanced.RawQuery <JObject>(
                                                       "match (Employees as e)-[Address where City = 'London']->(_ as l)").ToList());
         }
     }
 }
示例#21
0
        public void Query_without_alias_should_properly_fail()
        {
            using (var store = GetDocumentStore())
            {
                Samples.CreateNorthwindDatabase(store);
                using (var session = store.OpenSession())
                {
                    Assert.True(session.Advanced.RawQuery <JObject>("match (Orders as o where id() = 'orders/825-A') select o.Company").ToArray().Length > 0);
                    Assert.Throws <InvalidQueryException>(() => session.Advanced.RawQuery <JObject>("match (Orders as o where id() = 'orders/825-A') select Company").ToArray());

                    Assert.Throws <InvalidQueryException>(() => session.Advanced.RawQuery <JObject>("match (Orders as o where id() = 'orders/825-A') select o.Product, Company").ToArray());
                }
            }
        }
示例#22
0
 public void SortOnStringShouldWork()
 {
     using (var store = GetDocumentStore())
     {
         Samples.CreateNorthwindDatabase(store);
         using (var session = store.OpenSession())
         {
             var result = session.Advanced.RawQuery <Product>(@"
                 match (Products as p)
                 order by p.Name
                 ").First();
             Assert.Equal("products/17-A", result.Id);
         }
     }
 }
示例#23
0
        public async Task CanTalkToSecuredServer()
        {
            var certificates = Certificates.SetupServerAuthentication(EnablePostgresSqlSettings);
            var dbName       = GetDatabaseName();
            var adminCert    = Certificates.RegisterClientCertificate(certificates, new Dictionary <string, DatabaseAccess>(), SecurityClearance.ClusterAdmin);

            const string query = "from Employees";

            DoNotReuseServer(EnablePostgresSqlSettings);

            using (var store = GetDocumentStore(new Options
            {
                AdminCertificate = adminCert,
                ClientCertificate = adminCert,
                ModifyDatabaseName = s => dbName,
            }))
            {
                Samples.CreateNorthwindDatabase(store);

                store.Maintenance.Send(new ConfigurePostgreSqlOperation(new PostgreSqlConfiguration
                {
                    Authentication = new PostgreSqlAuthenticationConfiguration()
                    {
                        Users = new List <PostgreSqlUser>()
                        {
                            new PostgreSqlUser()
                            {
                                Username = CorrectUser,
                                Password = CorrectPassword
                            }
                        }
                    }
                }));

                using (var session = store.OpenAsyncSession())
                {
                    var employees = await session
                                    .Query <Employee>()
                                    .ToListAsync();

                    var result = await Act(store, query, Server);

                    Assert.NotNull(result);
                    Assert.NotEmpty(result.Rows);
                    Assert.Equal(employees.Count, result.Rows.Count);
                }
            }
        }
示例#24
0
 public void Missing_as_keyword_with_where_should_properly_throw_in_recursive_query()
 {
     using (var store = GetDocumentStore())
     {
         Samples.CreateNorthwindDatabase(store);
         WaitForUserToContinueTheTest(store);
         using (var session = store.OpenSession())
         {
             var e = Assert.Throws <InvalidQueryException>(() => session.Advanced.RawQuery <JObject>(@"
                 match (Employees e where id() = 'employees/7-A')- recursive as n { [ReportsTo as m]->(Employees as boss) }
                 select e.FirstName as Employee, n.m as MiddleManagement, boss.FirstName as Boss
             ").ToArray());
             Assert.True(e.Message.Contains("invalid", StringComparison.OrdinalIgnoreCase) && e.Message.Contains("alias", StringComparison.OrdinalIgnoreCase) && e.Message.Contains("e", StringComparison.OrdinalIgnoreCase));
         }
     }
 }
示例#25
0
 public void SortOnEdgesShouldWork()
 {
     using (var store = GetDocumentStore())
     {
         Samples.CreateNorthwindDatabase(store);
         using (var session = store.OpenSession())
         {
             var result = session.Advanced.RawQuery <Product>(@"
                 match (Orders as o)-[Lines as l select Product]->(Products as p) 
                 order by l.Discount as double  
                 select p
             ").First();
             Assert.Equal("Queso Cabrales", result.Name);
         }
     }
 }
示例#26
0
 public void Should_fail_on_invalid_projection_for_edge_arrays()
 {
     using (var store = GetDocumentStore())
     {
         Samples.CreateNorthwindDatabase(store);
         using (var session = store.OpenSession())
         {
             //the issue was that this query throws NRE at server-side.
             //instead this should throw proper InvalidQueryException
             Assert.Throws <InvalidQueryException>(() => session.Advanced.RawQuery <JObject>(
                                                       @"match (Orders as o where Company = 'companies/72-A')
                     -[Lines where Discount > 0 select product,discount]->(Products as p)"
                                                       ).ToList());
         }
     }
 }
示例#27
0
 public void MultipleSortShouldWork()
 {
     using (var store = GetDocumentStore())
     {
         Samples.CreateNorthwindDatabase(store);
         using (var session = store.OpenSession())
         {
             var result = session.Advanced.RawQuery <Order>(@"
                 match (Orders as o)-[Lines as l select Product]->(Products as p) 
                 order by o.OrderedAt desc , l.Discount as double  
                 select o
                 ").Skip(100).First();
             Assert.Equal("orders/799-A", result.Id);
         }
     }
 }
示例#28
0
 public void Throws_proper_exception_on_malformed_where_expression()
 {
     using (var store = GetDocumentStore())
     {
         Samples.CreateNorthwindDatabase(store);
         using (var session = store.OpenSession())
         {
             var e = Assert.Throws <InvalidQueryException>(() => session.Advanced.RawQuery <JObject>(
                                                               @"
                    match (Orders  as o where id() = 'orders/825-A')-[Lines[].Product where Lines[].Product]->(Products as p)
                 ").ToArray());
             Assert.True(e.Message.Contains("operator") &&
                         e.Message.Contains("Lines[].Product") &&
                         e.Message.Contains("]"));
         }
     }
 }
示例#29
0
        public void Throw_proper_error_for_alias_duplicates_in_graph_query()
        {
            using (var store = GetDocumentStore())
            {
                Samples.CreateNorthwindDatabase(store);
                using (var session = store.OpenSession())
                {
                    var e = Assert.Throws <InvalidQueryException>(() => session.Advanced.RawQuery <JObject>(@"
                        match (Employees as e where FirstName='Nancy')-[ReportsTo]->(Employees as manager)<-[ReportsTo]-(Employees as british where Address.City='London')
                        select manager.FirstName, british.FirstName, e.FirstName                    
                    ").ToList());

                    Assert.True(e.Message.Contains("Duplicate", StringComparison.InvariantCultureIgnoreCase) &&
                                e.Message.Contains("FirstName"));
                }
            }
        }
示例#30
0
        public void Should_conflict_on_implicitly_defined_aliases_on_edges()
        {
            using (var store = GetDocumentStore())
            {
                Samples.CreateNorthwindDatabase(store);
                using (var session = store.OpenSession())
                {
                    var e = Assert.Throws <InvalidQueryException>(() =>
                                                                  session.Advanced.RawQuery <JObject>(@"match (Employees)-[ReportsTo]->(Employees)-[ReportsTo as Employees_ReportsTo]->(Employees)").ToArray());

                    Assert.True(e.Message.Contains("implicit", StringComparison.OrdinalIgnoreCase));
                    Assert.True(e.Message.Contains("redefinition", StringComparison.OrdinalIgnoreCase));
                    Assert.True(e.Message.Contains("alias", StringComparison.OrdinalIgnoreCase));
                    Assert.True(e.Message.Contains("Employees_ReportsTo", StringComparison.OrdinalIgnoreCase));
                }
            }
        }