public void ResetDatabase()
 {
     using (var session = TckHooks.CreateSelfManagedSession())
     {
         session.Run("MATCH (n) DETACH DELETE n").Consume();
     }
 }
        public void WhenRunning(string statement)
        {
            var session = TckHooks.CreateSession();
            var result  = session.Run(statement);

            ScenarioContext.Current.Set(result);
        }
 public void GivenInit(string statement)
 {
     using (var session = TckHooks.CreateSelfManagedSession())
     {
         session.Run(statement).Consume();
     }
 }
        public void WhenTheDriverAsksTheServerToEchoThisValueBack()
        {
            var expected = ScenarioContext.Current.Get <object>(KeyExpected);
            var session  = TckHooks.CreateSession();

            _statementResult = session.Run("Return {input}", new Dictionary <string, object> {
                { "input", expected }
            });
        }
 public void WhenIRunANonValidCypherStatement()
 {
     using (var session = TckHooks.CreateSelfManagedSession())
     {
         var ex = Xunit.Record.Exception(() => session.Run("Invalid Cypher"));
         ex.Should().BeOfType <ClientException>();
         ex.Message.Should().StartWith("Invalid input");
     }
 }
Ejemplo n.º 6
0
 public void WhenIStartANewTransactionWithTheSameSessionBeforeClosingThePrevious()
 {
     using (var session = TckHooks.CreateSelfManagedSession())
         using (var tx = session.BeginTransaction())
         {
             var ex = Xunit.Record.Exception(() => session.BeginTransaction());
             ex.Should().BeOfType <ClientException>();
             ex.Message.Should().StartWith("Please close the currently open transaction object");
         }
 }
Ejemplo n.º 7
0
 public void WhenRunAQueryWithThatSameSessionWithoutClosingTheTransactionFirst()
 {
     using (var session = TckHooks.CreateSelfManagedSession())
         using (var tx = session.BeginTransaction())
         {
             var ex = Xunit.Record.Exception(() => session.Run("RETURN 1"));
             ex.Should().BeOfType <ClientException>();
             ex.Message.Should().StartWith("Please close the currently open transaction object");
         }
 }
        public void WhenRunningParameterized(string statement, Table table)
        {
            table.RowCount.Should().Be(1);
            var dict = table.Rows[0].Keys.ToDictionary <string, string, object>(key => key,
                                                                                key => _parser.Parse(table.Rows[0][key]));

            var session = TckHooks.CreateSession();
            var result  = session.Run(statement, dict);

            ScenarioContext.Current.Set(result);
        }
        public void WhenTheDriverAsksTheServerToEchoThisMapBack()
        {
            var map = ScenarioContext.Current.Get <IDictionary <string, object> >(Keymap);

            ScenarioContext.Current.Set((object)map, KeyExpected);

            var session = TckHooks.CreateSession();

            _statementResult = session.Run("Return {input}", new Dictionary <string, object> {
                { "input", map }
            });
        }
        public void WhenTheDriverAsksTheServerToEchoThisListBack()
        {
            var list = ScenarioContext.Current.Get <IList <object> >(KeyList);

            ScenarioContext.Current.Set((object)list, KeyExpected);

            var session = TckHooks.CreateSession();

            _statementResult = session.Run("Return {input}", new Dictionary <string, object> {
                { "input", list }
            });
        }
Ejemplo n.º 11
0
        public void GivenValue1IsSingleValueResultOf(string key, string statement)
        {
            using (var session = TckHooks.CreateSelfManagedSession())
            {
                var statementResult = session.Run(statement);
                var value           = statementResult.Single()[0];

                if (!ScenarioContext.Current.ContainsKey(ValueListkey))
                {
                    ScenarioContext.Current.Set(new List <object>(), ValueListkey);
                }
                var values = ScenarioContext.Current.Get <IList <object> >(ValueListkey);

                values.Add(value);
            }
        }
Ejemplo n.º 12
0
        public void ResetDatabase()
        {
            using (var session = TckHooks.CreateSelfManagedSession())
            {
                session.Run("MATCH (n) DETACH DELETE n").Consume();

                var dropConstraints =
                    session.Run("CALL db.constraints() YIELD description RETURN 'DROP ' + description");
                foreach (var drop in dropConstraints)
                {
                    session.Run(drop[0].ToString()).Consume();
                }

                var dropIndices =
                    session.Run("CALL db.indexes() YIELD description RETURN 'DROP ' + description");
                foreach (var drop in dropIndices)
                {
                    session.Run(drop[0].ToString()).Consume();
                }
            }
        }