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


C# SolrBasicServer.Delete方法代码示例

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


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

示例1: DeleteByQuery

 public void DeleteByQuery()
 {
     var mocks = new MockRepository();
     var connection = mocks.CreateMock<ISolrConnection>();
     var executer = mocks.CreateMock<ISolrQueryExecuter<TestDocumentWithUniqueKey>>();
     var docSerializer = mocks.CreateMock<ISolrDocumentSerializer<TestDocumentWithUniqueKey>>();
     With.Mocks(mocks)
         .Expecting(() => Expect.Call(connection.Post("/update", "<delete><query>id:123</query></delete>"))
                              .Repeat.Once()
                              .Return(null))
         .Verify(delegate {
             var ops = new SolrBasicServer<TestDocumentWithUniqueKey>(connection, executer, docSerializer);
             ops.Delete(null, new SolrQuery("id:123"));
         });
 }
开发者ID:osdezwart,项目名称:SolrNet,代码行数:15,代码来源:SolrOperationsTests.cs

示例2: DeleteByQuery

 public void DeleteByQuery()
 {
     var mocks = new MockRepository();
     var connection = mocks.StrictMock<ISolrConnection>();
     var headerParser = mocks.StrictMock<ISolrHeaderResponseParser>();
     var executer = mocks.StrictMock<ISolrQueryExecuter<TestDocumentWithUniqueKey>>();
     var docSerializer = mocks.StrictMock<ISolrDocumentSerializer<TestDocumentWithUniqueKey>>();
     var querySerializer = mocks.StrictMock<ISolrQuerySerializer>();
     With.Mocks(mocks)
         .Expecting(() => {
             Expect.On(querySerializer)
                 .Call(querySerializer.Serialize(null))
                 .IgnoreArguments()
                 .Return("id:123");
             Expect.On(connection)
                 .Call(connection.Post("/update", "<delete><query>id:123</query></delete>"))
                 .Repeat.Once()
                 .Return(EmbeddedResource.GetEmbeddedString(GetType(), "Resources.response.xml"));
             Expect.On(headerParser)
                 .Call(headerParser.Parse(null))
                 .IgnoreArguments()
                 .Return(new ResponseHeader());
         })
         .Verify(() => {
             var ops = new SolrBasicServer<TestDocumentWithUniqueKey>(connection, executer, docSerializer, null, headerParser, querySerializer, null, null);
             ops.Delete(null, new SolrQuery("id:123"));
         });
 }
开发者ID:Cort01,项目名称:SolrNet,代码行数:28,代码来源:SolrOperationsTests.cs

示例3: DeleteByQuery

 public void DeleteByQuery()
 {
     var connection = new MSolrConnection();
     connection.post += (url, content) => {
         Assert.AreEqual("/update", url);
         Assert.AreEqual("<delete><query>id:123</query></delete>", content);
         return EmbeddedResource.GetEmbeddedString(GetType(), "Resources.response.xml");
     };
     var headerParser = new MSolrHeaderResponseParser();
     headerParser.parse += _ => null;
     var querySerializer = new MSolrQuerySerializer();
     querySerializer.serialize += _ => "id:123";
     var ops = new SolrBasicServer<TestDocumentWithUniqueKey>(connection, null, null, null, headerParser, querySerializer, null, null);
     ops.Delete(null, new SolrQuery("id:123"));
     Assert.AreEqual(1, connection.post.Calls);
 }
开发者ID:rivuc,项目名称:SolrNet-1,代码行数:16,代码来源:SolrOperationsTests.cs


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