本文整理汇总了C#中Page.ExportJson方法的典型用法代码示例。如果您正苦于以下问题:C# Page.ExportJson方法的具体用法?C# Page.ExportJson怎么用?C# Page.ExportJson使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Page
的用法示例。
在下文中一共展示了Page.ExportJson方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShouldExportAsJson
public void ShouldExportAsJson()
{
var page = new Page()
{
Title = "FooPage"
};
var result = page.ExportJson();
const string key = "\"Title\":\"FooPage\"";
Assert.Greater( result.IndexOf( key ), -1 );
}
示例2: ShouldExportChildPages
public void ShouldExportChildPages()
{
var page = new Page()
{
Title = "FooPage",
Pages = new List<Page> { new Page { Title = "BarPage" } }
};
var result = page.ExportJson();
result = result.Substring( result.IndexOf( "\"Pages\":" ) + 7 );
const string key = "\"Title\":\"BarPage\"";
Assert.Greater( result.IndexOf( key ), -1 );
}
示例3: ShouldExportChildPagesRecursively
public void ShouldExportChildPagesRecursively()
{
var parent = new Page() { Title = "Parent" };
var child = new Page() { Title = "Child" };
var grandchild = new Page() { Title = "Grandchild" };
parent.Pages = new List<Page> { child };
child.Pages = new List<Page> { grandchild };
var result = parent.ExportJson();
const string parentKey = "\"Title\":\"Parent\"";
const string childKey = "\"Title\":\"Child\"";
const string grandChildKey = "\"Title\":\"Grandchild\"";
Assert.Greater( result.IndexOf( parentKey ), -1 );
Assert.Greater( result.IndexOf( childKey ), -1 );
Assert.Greater( result.IndexOf( grandChildKey ), -1 );
}
示例4: ShouldNotBeEmpty
public void ShouldNotBeEmpty()
{
var page = new Page();
var result = page.ExportJson();
Assert.IsNotEmpty( result );
}