本文整理匯總了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();
});
});
}
示例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);
}
示例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);
}
}
示例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();
});
});
}
示例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);
}