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


C# XmlDocument.ShouldNotBeNull方法代码示例

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


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

示例1: should_be_able_to_login_and_download_xml

        public void should_be_able_to_login_and_download_xml()
        {
            Scenario.StartNew(this, scenario =>
            {
                scenario.Given(xmlDownloader_is_created_with_valid_credentials);
                scenario.When("getting xml document with valid credentials");
                scenario.Then("the server should return a default reply", ()=>
                {
                    string result = XmlDownloader.GetXmlDocumentString(VALID_URL);
                    result.ShouldNotBeNull();
                    XmlDocument xmlDocument = new XmlDocument();
                    xmlDocument.LoadXml(result);

                    xmlDocument.ShouldNotBeNull();
                });
            });
        }
开发者ID:ArildF,项目名称:Smeedee,代码行数:17,代码来源:XmlDownloaderSpecs.cs

示例2: PostXml

        /// <summary>
        /// HTTP POST 방식으로 응답을 받아 <see cref="XmlDocument"/> 의 인스턴스로 빌드하여 반환한다.
        /// </summary>
        /// <param name="uri">응답받을 서버 주소</param>
        /// <param name="document">응답 요청시의 Form Parameter 정보</param>
        /// <param name="isAsync">비동기 여부</param>
        /// <param name="timeoutMilliseconds">통신 Timeout</param>
        /// <param name="userId">계정 Id</param>
        /// <param name="password">계정 비밀번호</param>
        /// <returns>응답정보를 담은 <see cref="XmlDocument"/></returns>
        public static XmlDocument PostXml(string uri,
                                          XmlDocument document,
                                          bool isAsync = false,
                                          int timeoutMilliseconds = System.Threading.Timeout.Infinite,
                                          string userId = null,
                                          string password = null) {
            uri.ShouldNotBeWhiteSpace("uri");
            document.ShouldNotBeNull("document");
            Guard.Assert(document.IsValidDocument(), "document is not valid xml document.");

            if(IsDebugEnabled) {
                log.Debug("PostXml... uri=[{0}], isAsync=[{1}], timeout=[{2}], userId=[{3}], password=[{4}], document=[{5}]",
                          uri, isAsync, timeoutMilliseconds, userId, password, document);

                if(document != null)
                    log.Debug("PostXml FormData=[{0}]", document.InnerXml);
            }

            var xmlHttp = new XmlHttpClient(uri, isAsync, timeoutMilliseconds, userId, password);
            return xmlHttp.PostXml(document);
        }
开发者ID:debop,项目名称:NFramework,代码行数:31,代码来源:XmlHttpTool.cs

示例3: PostXml

        /// <summary>
        /// Post 방식의 XmlHttp 통신. XmlDocument를 받는다.
        /// </summary>
        /// <param name="document"></param>
        /// <returns></returns>
        public XmlDocument PostXml(XmlDocument document) {
            document.ShouldNotBeNull("requestDoc");
            Guard.Assert(document.IsValidDocument(), @"document is not valid xml document.");

            using(Stream stream = PostStream(document)) {
                return XmlTool.CreateXmlDocument(stream);
            }
        }
开发者ID:debop,项目名称:NFramework,代码行数:13,代码来源:XmlHttpClient.cs

示例4: should_remove_html_tags

 public void should_remove_html_tags()
 {
     Scenario.StartNew(this, scenario =>
     {
         scenario.Given(xmlDownloader_is_created_with_valid_credentials);
         scenario.When("getting xml that contains html tags from valid url");
         scenario.Then("XmlDownloader should remove the html tags", ()=>
         {
             string result = XmlDownloader.GetXmlDocumentString(VALID_URL_WITH_HTML_TAGS);
             XmlDocument xmlDocument = new XmlDocument();
             xmlDocument.LoadXml(result);
             xmlDocument.ShouldNotBeNull();
         });
     });
 }
开发者ID:ArildF,项目名称:Smeedee,代码行数:15,代码来源:XmlDownloaderSpecs.cs

示例5: XmlDoc

        /// <summary>
        /// 생성자 - <paramref name="document"/>을 읽어서 새로운 <see cref="XmlDocument"/> 인스턴스를 생성한다.
        /// </summary>
        /// <param name="document">원본 XmlDocument</param>
        public XmlDoc(XmlDocument document) {
            document.ShouldNotBeNull("document");
            Guard.Assert(document.IsValidDocument(), "Invalid content of xml document.");

            LoadXml(document.OuterXml);
        }
开发者ID:debop,项目名称:NFramework,代码行数:10,代码来源:XmlDoc.cs


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