You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2020/04/09 15:22:15 UTC

[tinkerpop] 05/06: Added in .net session test improvement that were added in 3.3-dev

This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit 183b2c9e1bc4fb448b96bbe419b0bc0fca68eab7
Author: Stephen Mallette <sp...@genoprime.com>
AuthorDate: Thu Apr 9 11:18:44 2020 -0400

    Added in .net session test improvement that were added in 3.3-dev
    
    The change was merged forward from 3.3-dev but the change was ignored since it came with other baggage that didn't need to affect 3.4-dev and master. More specifically, the session feature was added to 3.4-dev first unfortunately and then later added on 3.3-dev after the fact and the 3.3-dev changes essentially conflict pretty hard with 3.4-dev at this point that it was just better to ignore them on merging the commits forward. CTR
---
 .../Driver/GremlinClientTests.cs                   | 24 ++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Driver/GremlinClientTests.cs b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Driver/GremlinClientTests.cs
index cd94c01..e2c6ef6 100644
--- a/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Driver/GremlinClientTests.cs
+++ b/gremlin-dotnet/test/Gremlin.Net.IntegrationTest/Driver/GremlinClientTests.cs
@@ -283,12 +283,28 @@ namespace Gremlin.Net.IntegrationTest.Driver
         public async Task ShouldSaveVariableBetweenRequestsInSession()
         {
             var gremlinServer = new GremlinServer(TestHost, TestPort);
-            using (var gremlinClient = new GremlinClient(gremlinServer, sessionId: Guid.NewGuid().ToString()))
+            var sessionId = Guid.NewGuid().ToString();
+            using (var gremlinClient = new GremlinClient(gremlinServer, sessionId: sessionId))
             {
-                await gremlinClient.SubmitWithSingleResultAsync<int>("x = 1");
+                await gremlinClient.SubmitAsync<int>("x = 1");
 
-                var response = await gremlinClient.SubmitWithSingleResultAsync<int>("x + 2");
-                Assert.Equal(3, response);
+                var expectedResult = new List<int> {3};
+                var response = await gremlinClient.SubmitAsync<int>("x + 2");
+
+                Assert.Equal(expectedResult, response);
+            }
+
+            using (var gremlinClient = new GremlinClient(gremlinServer, sessionId: sessionId))
+            {
+                try
+                {
+                    await gremlinClient.SubmitAsync<int>("x");
+                    Assert.True(false, "The 'x' variable should not exist after session close");
+                }
+                catch (Exception ignored)
+                {
+                    // do nothing
+                }
             }
         }
     }