本文整理汇总了C#中GlassHtml.GetRenderingParameters方法的典型用法代码示例。如果您正苦于以下问题:C# GlassHtml.GetRenderingParameters方法的具体用法?C# GlassHtml.GetRenderingParameters怎么用?C# GlassHtml.GetRenderingParameters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GlassHtml
的用法示例。
在下文中一共展示了GlassHtml.GetRenderingParameters方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderingParameters_StringPassedInWithParametersUsingIdOnType_ReturnsModelWithValues
public void RenderingParameters_StringPassedInWithParametersUsingIdOnType_ReturnsModelWithValues()
{
//Arrange
var expectedNumber = 234;
var expectedId1 = new Guid("{032B690F-5113-44C4-AEC7-A16B44382D4C}");
var expectedId2 = new Guid("{6CF01319-0234-42C8-AEC1-FE757169F7A0}");
var expectedFieldValue = "hello world";
var parameters = "StringField={0}&Number={1}&Items={2}"
.Formatted(
WebUtil.UrlEncode(expectedFieldValue),
WebUtil.UrlEncode(expectedNumber.ToString()),
WebUtil.UrlEncode("{0}|{1}".Formatted(expectedId1, expectedId2)));
var db = Sitecore.Configuration.Factory.GetDatabase("master");
var context = Context.Create(Utilities.CreateStandardResolver());
context.Load(new SitecoreAttributeConfigurationLoader("Glass.Mapper.Sc.Integration"));
var service = new SitecoreContext(db);
var html = new GlassHtml(service);
//Act
var result = html.GetRenderingParameters<RenderingTestWithAttribute>(parameters);
//Assert
Assert.AreEqual(expectedNumber, result.Number);
Assert.AreEqual(expectedFieldValue, result.StringField);
Assert.IsTrue(result.Items.Any(x => x.Id == expectedId1));
Assert.IsTrue(result.Items.Any(x => x.Id == expectedId2));
Assert.AreEqual(2, result.Items.Count());
}