Пример #1
0
        public void ExecutesQueryAsync()
        {
            // Arrange
            var client = Substitute.For<IRawGraphClient>();
            CypherQuery executedQuery = null;
            client
                .When(c => c.ExecuteCypherAsync(Arg.Any<CypherQuery>()))
                .Do(ci => { executedQuery = ci.Arg<CypherQuery>(); });

            // Act
            var task = new CypherFluentQuery(client)
                .Start("n", (NodeReference) 5)
                .Delete("n")
                .ExecuteWithoutResultsAsync();
            task.Wait();

            // Assert
            Assert.IsNotNull(executedQuery, "Query was not executed against graph client");
            Assert.AreEqual("START n=node({p0})\r\nDELETE n", executedQuery.QueryText);
            Assert.AreEqual(5, executedQuery.QueryParameters["p0"]);
        }
Пример #2
0
        public void ExecutesQueryAsync()
        {
            // Arrange
            var         client        = Substitute.For <IRawGraphClient>();
            CypherQuery executedQuery = null;

            client
            .When(c => c.ExecuteCypherAsync(Arg.Any <CypherQuery>()))
            .Do(ci => { executedQuery = ci.Arg <CypherQuery>(); });

            // Act
            var task = new CypherFluentQuery(client)
                       .Match("n")
                       .Delete("n")
                       .ExecuteWithoutResultsAsync();

            task.Wait();

            // Assert
            Assert.NotNull(executedQuery);
            Assert.Equal("MATCH n" + Environment.NewLine + "DELETE n", executedQuery.QueryText);
        }
Пример #3
0
        public void ExecutesQueryAsync()
        {
            // Arrange
            var         client        = Substitute.For <IRawGraphClient>();
            CypherQuery executedQuery = null;

            client
            .When(c => c.ExecuteCypherAsync(Arg.Any <CypherQuery>()))
            .Do(ci => { executedQuery = ci.Arg <CypherQuery>(); });

            // Act
            var task = new CypherFluentQuery(client)
                       .Start("n", (NodeReference)5)
                       .Delete("n")
                       .ExecuteWithoutResultsAsync();

            task.Wait();

            // Assert
            Assert.IsNotNull(executedQuery, "Query was not executed against graph client");
            Assert.AreEqual("START n=node({p0})\r\nDELETE n", executedQuery.QueryText);
            Assert.AreEqual(5, executedQuery.QueryParameters["p0"]);
        }