本文整理汇总了C#中ViewDataDictionary.GetViewDataInfo方法的典型用法代码示例。如果您正苦于以下问题:C# ViewDataDictionary.GetViewDataInfo方法的具体用法?C# ViewDataDictionary.GetViewDataInfo怎么用?C# ViewDataDictionary.GetViewDataInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ViewDataDictionary
的用法示例。
在下文中一共展示了ViewDataDictionary.GetViewDataInfo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetViewDataInfoFromModel
public void GetViewDataInfoFromModel()
{
// Arrange
object model = new { foo = "fooValue" };
ViewDataDictionary vdd = new ViewDataDictionary(model);
PropertyDescriptor propDesc = TypeDescriptor.GetProperties(model).Find("foo", true /* ignoreCase */);
// Act
ViewDataInfo info = vdd.GetViewDataInfo("foo");
// Assert
Assert.NotNull(info);
Assert.Equal(model, info.Container);
Assert.Equal(propDesc, info.PropertyDescriptor);
Assert.Equal("fooValue", info.Value);
}
示例2: GetViewDataInfoFromDictionaryWithMissingEntry
public void GetViewDataInfoFromDictionaryWithMissingEntry()
{
// Arrange
ViewDataDictionary vdd = new ViewDataDictionary();
// Act
ViewDataInfo info = vdd.GetViewDataInfo("foo");
// Assert
Assert.Null(info);
}
示例3: GetViewDataInfoFromDictionaryWithNullEntry
public void GetViewDataInfoFromDictionaryWithNullEntry()
{
// Arrange
ViewDataDictionary vdd = new ViewDataDictionary()
{
{ "Foo", null }
};
// Act
ViewDataInfo info = vdd.GetViewDataInfo("foo");
// Assert
Assert.NotNull(info);
Assert.Equal(vdd, info.Container);
Assert.Null(info.Value);
}
示例4: GetViewDataInfoFromDictionary
public void GetViewDataInfoFromDictionary()
{
// Arrange
ViewDataDictionary fooVdd = new ViewDataDictionary()
{
{ "Bar", "barValue" }
};
ViewDataDictionary vdd = new ViewDataDictionary()
{
{ "Foo", fooVdd }
};
// Act
ViewDataInfo info = vdd.GetViewDataInfo("foo.bar");
// Assert
Assert.NotNull(info);
Assert.Equal(fooVdd, info.Container);
Assert.Equal("barValue", info.Value);
}