Beispiel #1
0
        public async void TestQueryMultiple()
        {
            var persons = new List <Person>()
            {
                new Person()
                {
                    Age         = 50,
                    DateOfBirth = DateTime.Now.AddYears(-50),
                    Id          = Guid.NewGuid(),
                    Name        = "neo",
                    Salary      = 5400.77,
                },
                new Person()
                {
                    Age         = 50,
                    DateOfBirth = DateTime.Now.AddYears(-50),
                    Id          = Guid.NewGuid(),
                    Name        = "neo",
                    Salary      = 5400.77,
                }
            };
            var            context         = new NeoContext(Driver);
            IResultSummary resultExecuting = await context.InsertNodes <Person>(persons);

            IEnumerable <Person> personsResult = await context.QueryMultiple <Person>("MATCH (p:Person) return p");

            await context.ExecuteQuery("MATCH (p:Person) DETACH DELETE p");
        }
Beispiel #2
0
        public async void TestInsertMultipleQueryGeneric()
        {
            var expectedCountries = new Dictionary <string, Country>()
            {
                { "555", new Country()
                  {
                      CountryID = "555", CountryName = "NOM COUNTRY"
                  } },
                { "556", new Country()
                  {
                      CountryID = "556", CountryName = "NOM COUNTRY2"
                  } },
            };
            var context         = new NeoContext(Driver);
            var resultExecuting = await context.InsertNodes <Country>(expectedCountries.Values);

            var resultCountry = await context.QueryMultiple <Country>("match(n:Country) WHERE n.CountryID IN ['555','556'] return n");

            Assert.True(resultExecuting.QueryType == Neo4j.Driver.QueryType.WriteOnly);
            Assert.True(expectedCountries.Count == resultCountry.Count());
            foreach (var resCountry in resultCountry)
            {
                Assert.True(IsEqual(resCountry, expectedCountries[resCountry.CountryID]));
            }
            await context.ExecuteQuery("MATCH (n:Country) WHERE n.CountryID IN ['555','556'] DETACH DELETE n");
        }