public void WhenTheValueGivenInTheResultShouldBeTheSameAsWhatWasSent()
        {
            // param : input
            var record = _statementResult.Single();

            record.Should().NotBeNull();
            var actual   = record[0];
            var expected = ScenarioContext.Current.Get <object>(KeyExpected);

            TckUtil.AssertEqual(expected, actual);
        }
Example #2
0
        /// <summary>
        /// Adds the given node to the graph.
        /// PRECONDITION: The node must be valid
        /// </summary>
        /// <param name="node">The BasicNodeModel of the node to add to the graph</param>
        /// <returns>Returns true if the node was added to the graph successfully</returns>
        public bool AddNode(BasicNodeModel node)
        {
            INode sessionResult;

            // Create the session
            using (ISession session = driver.Session())
            {
                // Run the statement in a transaction
                sessionResult = session.WriteTransaction(action =>
                {
                    // Create the node
                    IStatementResult result = action.Run(BuildNodeCreationQuery(node), new { props = node.GetPropertyMap() });

                    return(result.Single()[0].As <INode>());
                });
            }

            return(sessionResult != null);
        }
Example #3
0
        /// <summary>
        /// Adds the given node to the graph.
        /// PRECONDITION: The node must be valid
        /// </summary>
        /// <param name="node">The BasicNodeModel of the node to add to the graph</param>
        /// <returns>Returns true if the node was added to the graph successfully</returns>
        public bool AddNode(BasicNodeModel node)
        {
            INode sessionResult;

            // Create the session
            using (ISession session = driver.Session())
            {
                // Run the statement in a transaction
                sessionResult = session.WriteTransaction(action =>
                {
                    // Create the node
                    IStatementResult result = action.Run(BuildNodeCreationQuery(node), new { props = node.GetPropertyMap() });
                    return(result.Single()[0].As <INode>());
                });
            }

            Program.LogInColor($"Neo4j: Added {node.CommonName} with id {node.Id} to graph.", ConsoleColor.DarkGreen);
            return(sessionResult != null);
        }