コード例 #1
0
        public GraphStoreTests()
        {
            var configuration      = MockBuilder.BuildConfiguration();
            var graphClientFactory = new GraphClientFactory(NeoServerConfiguration.GetConfiguration(new Uri($"{configuration.GraphStore.Url}/db/data"), configuration.GraphStore.Username, configuration.GraphStore.Password));

            _graphStore = new GraphStore(graphClientFactory.Create(), false);
        }
コード例 #2
0
ファイル: Parser.cs プロジェクト: st9200/soal-oslo
        public Parser(ParserFactory parserFactory)
        {
            this.parser = parserFactory.Create();
            this.store = new DefaultGraphStore();
            this.locations = new Dictionary<object, SourceSpan>();
            this.parser.GraphBuilder = new NodeGraphBuilder(store);

            this.parser.SyntaxMatched += new EventHandler<SyntaxMatchedEventArgs>(parser_SyntaxMatched);
        }
コード例 #3
0
        public void InitializeThenGetClientReturnsClient()
        {
            var graphStore = new GraphStore("http://localhost:7474/");

            graphStore.Initialize();
            var client = graphStore.GetClient();

            Assert.That(client, Is.InstanceOf <NeoClient>());
        }
コード例 #4
0
        public void TransactionRollsbackWhenNotScopeComplete()
        {
            this.graphStore = new GraphStore("http://localhost:7474/");
            this.graphStore.Initialize();
            var neoClient  = this.graphStore.GetClient();
            var randomText = this.RandomString(12);
            int newId      = -1;

            using (var ts = new TransactionScope())
            {
                var reader = neoClient.QueryAsync("CREATE (n:Person  { name:'" + randomText + "' }) RETURN Id(n)").Result;
                Assert.That(reader.Read(), Is.EqualTo(true));
                newId = reader.Get <int>(0);
                Assert.That(newId, Is.GreaterThan(-1));
            }

            var queryReader = neoClient.QueryAsync("MATCH (n:Person) WHERE n.name ='" + randomText + "' RETURN Id(n)").Result;

            Assert.That(queryReader.Read(), Is.EqualTo(false));
        }
コード例 #5
0
        public void CallingGetClientBeforeInitializeThrowsInvalidOperationException()
        {
            var graphStore = new GraphStore("http://localhost:7474/");

            Assert.Throws <InvalidOperationException>(() => graphStore.GetClient());
        }
コード例 #6
0
        public void InitialiseThrowsExecptionWithInvalidUrl()
        {
            var graphStore = new GraphStore("http://www.google.com/");

            Assert.Throws <JsonReaderException>(graphStore.Initialize);
        }
コード例 #7
0
 public void SetupOnce()
 {
     this.graphStore = new GraphStore("http://localhost:7474/", new JsonHttpClientWrapper("neo4j", "longbow"));
     this.graphStore.Initialize();
 }