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


C# ArrayList.AddItem方法代码示例

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


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

示例1: TestDocWithAttachment

 /// <exception cref="System.IO.IOException"></exception>
 public virtual void TestDocWithAttachment()
 {
     string inlineTextString = "Inline text string created by cblite functional test";
     Send("PUT", "/db", Status.Created, null);
     IDictionary<string, object> attachment = new Dictionary<string, object>();
     attachment.Put("content_type", "text/plain");
     attachment.Put("data", "SW5saW5lIHRleHQgc3RyaW5nIGNyZWF0ZWQgYnkgY2JsaXRlIGZ1bmN0aW9uYWwgdGVzdA=="
         );
     IDictionary<string, object> attachments = new Dictionary<string, object>();
     attachments.Put("inline.txt", attachment);
     IDictionary<string, object> docWithAttachment = new Dictionary<string, object>();
     docWithAttachment.Put("_id", "docWithAttachment");
     docWithAttachment.Put("text", inlineTextString);
     docWithAttachment.Put("_attachments", attachments);
     IDictionary<string, object> result = (IDictionary<string, object>)SendBody("PUT", 
         "/db/docWithAttachment", docWithAttachment, Status.Created, null);
     IDictionary expChanges = new Dictionary<string, IDictionary<string, object>>();
     IList changesResults = new ArrayList();
     IDictionary docChanges = new Dictionary<string, object>();
     docChanges.Put("id", "docWithAttachment");
     docChanges.Put("seq", 1);
     IList lChanges = new AList<IDictionary<string, object>>();
     Hashtable mChanges = new Dictionary<string, object>();
     mChanges.Put("rev", result.Get("rev"));
     lChanges.AddItem(mChanges);
     docChanges.Put("changes", lChanges);
     changesResults.AddItem(docChanges);
     expChanges.Put("results", changesResults);
     expChanges.Put("last_seq", 1);
     Send("GET", "/db/_changes?feed=normal&heartbeat=300000&style=all_docs", Status.Ok
         , expChanges);
     result = (IDictionary<string, object>)Send("GET", "/db/docWithAttachment", Status
         .Ok, null);
     IDictionary<string, object> attachmentsResult = (IDictionary<string, object>)result
         .Get("_attachments");
     IDictionary<string, object> attachmentResult = (IDictionary<string, object>)attachmentsResult
         .Get("inline.txt");
     // there should be either a content_type or content-type field.
     //https://github.com/couchbase/couchbase-lite-android-core/issues/12
     //content_type becomes null for attachments in responses, should be as set in Content-Type
     string contentTypeField = (string)attachmentResult.Get("content_type");
     NUnit.Framework.Assert.IsTrue(attachmentResult.ContainsKey("content_type"));
     NUnit.Framework.Assert.IsNotNull(contentTypeField);
     URLConnection conn = SendRequest("GET", "/db/docWithAttachment/inline.txt", null, 
         null);
     string contentType = conn.GetHeaderField("Content-Type");
     NUnit.Framework.Assert.IsNotNull(contentType);
     NUnit.Framework.Assert.IsTrue(contentType.Contains("text/plain"));
     StringWriter writer = new StringWriter();
     IOUtils.Copy(conn.GetInputStream(), writer, "UTF-8");
     string responseString = writer.ToString();
     NUnit.Framework.Assert.IsTrue(responseString.Contains(inlineTextString));
 }
开发者ID:transformersprimeabcxyz,项目名称:_TO-DO-couchbase-lite-net-couchbase,代码行数:54,代码来源:RouterTest.cs


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