当前位置: 首页>>代码示例>>C#>>正文


C# RestTestHarness.CreateGraphClient方法代码示例

本文整理汇总了C#中RestTestHarness.CreateGraphClient方法的典型用法代码示例。如果您正苦于以下问题:C# RestTestHarness.CreateGraphClient方法的具体用法?C# RestTestHarness.CreateGraphClient怎么用?C# RestTestHarness.CreateGraphClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RestTestHarness的用法示例。


在下文中一共展示了RestTestHarness.CreateGraphClient方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReturnsCorrectError_WhenTransactionIsAutomaticallyRolledBack_ViaNeo4j_2_2_6_Plus

 //https://github.com/Readify/Neo4jClient/issues/127
 public void ReturnsCorrectError_WhenTransactionIsAutomaticallyRolledBack_ViaNeo4j_2_2_6_Plus([Values(RestTestHarness.Neo4jVersion.Neo226/*, RestTestHarness.Neo4jVersion.Neo23*/)] RestTestHarness.Neo4jVersion version)
 {
     /* In 2.2.6 ClientErrors (Constraint Violations etc) were changed to Automatically rollback. This created a 404 error when *we* tried to rollback on an error, as the transaction no longer existed. */
     var initTransactionRequest = MockRequest.PostJson("/transaction", @"{
         'statements': [{'statement': 'MATCH n\r\nRETURN count(n)', 'resultDataContents':[], 'parameters': {}}]}");
     var rollbackTransactionRequest = MockRequest.Delete("/transaction/1");
     using (var testHarness = new RestTestHarness
     {
         {
             initTransactionRequest,
             MockResponse.Json(201, TransactionRestResponseHelper.GenerateCypherErrorResponse(1, "{\"code\":\"Neo.ClientError.Schema.ConstraintViolation\",\"message\":\"Node 19572 already exists with label User and property.\"}"), "http://foo/db/data/transaction/1")
         },
         {
             rollbackTransactionRequest, MockResponse.Json(404, "{\"results\":[],\"errors\":[{\"code\":\"Neo.ClientError.Transaction.UnknownId\",\"message\":\"Unrecognized transaction id. Transaction may have timed out and been rolled back.\"}]}")
         }
     })
     {
         var client = testHarness.CreateGraphClient(version);
         client.Connect();
         using (var transaction = client.BeginTransaction())
         {
             client.Cypher.Match("n").Return(n => n.Count()).ExecuteWithoutResults();
         }
     }
 }
开发者ID:albumprinter,项目名称:Neo4jClient,代码行数:26,代码来源:TransactionManagementTests.cs

示例2: ReturnsThe404_WhenVersionIs_2_2_6_Plus_WhenActuallyTimingOut

 //https://github.com/Readify/Neo4jClient/issues/127
 public void ReturnsThe404_WhenVersionIs_2_2_6_Plus_WhenActuallyTimingOut([Values(RestTestHarness.Neo4jVersion.Neo226, RestTestHarness.Neo4jVersion.Neo23)] RestTestHarness.Neo4jVersion version)
 {
     var initTransactionRequest = MockRequest.PostJson("/transaction", @"{
         'statements': [{'statement': 'MATCH n\r\nRETURN count(n)', 'resultDataContents':[], 'parameters': {}}]}");
     var rollbackTransactionRequest = MockRequest.Delete("/transaction/1");
     using (var testHarness = new RestTestHarness()
     {
         {
             initTransactionRequest,
             MockResponse.Json(201, TransactionRestResponseHelper.GenerateInitTransactionResponse(1), "http://foo/db/data/transaction/1")
         },
         {
             rollbackTransactionRequest, MockResponse.Json(404, "{\"results\":[],\"errors\":[{\"code\":\"Neo.ClientError.Transaction.UnknownId\",\"message\":\"Unrecognized transaction id. Transaction may have timed out and been rolled back.\"}]}")
         }
     })
     {
         var client = testHarness.CreateGraphClient(version);
         client.Connect();
         try
         {
             using (var transaction = client.BeginTransaction())
             {
                 client.Cypher.Match("n").Return(n => n.Count()).ExecuteWithoutResults();
             }
             Assert.Fail("Should not reach this code, as there is an expected exception.");
         }
         catch (ApplicationException ex)
         {
             Assert.That(ex.Message.Contains("404"));
         }
     }
 }
开发者ID:albumprinter,项目名称:Neo4jClient,代码行数:33,代码来源:TransactionManagementTests.cs

示例3: BeginTransactionShouldFailWithLower20Versions

 public void BeginTransactionShouldFailWithLower20Versions()
 {
     using (var testHarness = new RestTestHarness())
     {
         var client = testHarness.CreateGraphClient(false);
         client.Connect();
         client.BeginTransaction();
     }
 }
开发者ID:neildobson71,项目名称:Neo4jClient,代码行数:9,代码来源:TransactionManagementTests.cs

示例4: BeginTransactionShouldFailWithLower20Versions

 public void BeginTransactionShouldFailWithLower20Versions()
 {
     using (var testHarness = new RestTestHarness())
     {
         var client = testHarness.CreateGraphClient(RestTestHarness.Neo4jVersion.Neo19);
         client.Connect();
         Assert.That(() => client.BeginTransaction(), Throws.TypeOf<NotSupportedException>());
     }
 }
开发者ID:Readify,项目名称:Neo4jClient,代码行数:9,代码来源:TransactionManagementTests.cs

示例5: ReturnsThe404_WhenVersionIsLessThan_2_2_6

 //https://github.com/Readify/Neo4jClient/issues/127
 public void ReturnsThe404_WhenVersionIsLessThan_2_2_6([Values(RestTestHarness.Neo4jVersion.Neo20, RestTestHarness.Neo4jVersion.Neo22, RestTestHarness.Neo4jVersion.Neo225)] RestTestHarness.Neo4jVersion version)
 {
     var initTransactionRequest = MockRequest.PostJson("/transaction", @"{
         'statements': [{'statement': 'MATCH n\r\nRETURN count(n)', 'resultDataContents':[], 'parameters': {}}]}");
     var rollbackTransactionRequest = MockRequest.Delete("/transaction/1");
     using (var testHarness = new RestTestHarness
     {
         {
             initTransactionRequest,
             MockResponse.Json(201, TransactionRestResponseHelper.GenerateCypherErrorResponse(1, "{\"code\":\"Neo.ClientError.Schema.ConstraintViolation\",\"message\":\"Node 19572 already exists with label User and property.\"}"), "http://foo/db/data/transaction/1")
         },
         {
             rollbackTransactionRequest, MockResponse.Json(404, "{\"results\":[],\"errors\":[{\"code\":\"Neo.ClientError.Transaction.UnknownId\",\"message\":\"Unrecognized transaction id. Transaction may have timed out and been rolled back.\"}]}")
         }
     })
     {
         var client = testHarness.CreateGraphClient(version);
         client.Connect();
         try
         {
             using (var transaction = client.BeginTransaction())
             {
                 client.Cypher.Match("n").Return(n => n.Count()).ExecuteWithoutResults();
             }
         }
         catch (ApplicationException ex)
         {
             Assert.That(ex.Message.Contains("404"));
         }
     }
 }
开发者ID:albumprinter,项目名称:Neo4jClient,代码行数:32,代码来源:TransactionManagementTests.cs


注:本文中的RestTestHarness.CreateGraphClient方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。