本文整理汇总了C#中TagModel.SearchInTagScope方法的典型用法代码示例。如果您正苦于以下问题:C# TagModel.SearchInTagScope方法的具体用法?C# TagModel.SearchInTagScope怎么用?C# TagModel.SearchInTagScope使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TagModel
的用法示例。
在下文中一共展示了TagModel.SearchInTagScope方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CheckLoadingOfBundle
public void CheckLoadingOfBundle()
{
var model = new TagModel(new Hashtable());
var tag = new Bundle();
tag.BaseName = new MockAttribute(new Constant("FormatTags/test"));
Assert.That(tag.Evaluate(model), Is.EqualTo(String.Empty));
Assert.That(model.SearchInTagScope(FormatConstants.BUNDLE), Is.Not.Null);
Assert.That(model.SearchInTagScope(FormatConstants.BUNDLE) is ResourceBundle, Is.True);
var bundle = (ResourceBundle) model.SearchInTagScope(FormatConstants.BUNDLE);
Assert.That(bundle.BaseName, Is.EqualTo("FormatTags/test"));
}
示例2: TestSettingOfPrefix
public void TestSettingOfPrefix()
{
var model = new TagModel(new Hashtable());
var tag = new Bundle();
tag.BaseName = new MockAttribute(new Constant("FormatTags/test"));
tag.Prefix = new MockAttribute(new Constant("pre_"));
Assert.That(tag.Evaluate(model), Is.EqualTo(String.Empty));
var bundle = (ResourceBundle) model.SearchInTagScope(FormatConstants.BUNDLE);
Assert.That(bundle.Prefix, Is.EqualTo("pre_"));
}
示例3: SeachInTagScopeEmpyScopeTwoScopesValuesOverride
public void SeachInTagScopeEmpyScopeTwoScopesValuesOverride()
{
var model = new TagModel(new Reflection(new Hashtable()));
model.PushTagStack();
model.Tag["a"] = 0;
model.PushTagStack();
model.Tag["a"] = 1;
Assert.That(model.SearchInTagScope("a"), Is.EqualTo(1));
model.PopTagStack();
Assert.That(model.SearchInTagScope("a"), Is.EqualTo(0));
}
示例4: SeachInTagScopeEmpyScopeThreeScopesValueInTheSecondScope
public void SeachInTagScopeEmpyScopeThreeScopesValueInTheSecondScope()
{
var model = new TagModel(new Reflection(new Hashtable()));
model.PushTagStack();
model.PushTagStack();
model.Tag["a"] = 1;
model.PushTagStack();
Assert.That(model.SearchInTagScope("a"), Is.EqualTo(1));
}
示例5: SeachInTagScopeEmpyScope
public void SeachInTagScopeEmpyScope()
{
var model = new TagModel(new Reflection(new Hashtable()));
Assert.That(model.SearchInTagScope("a"), Is.Null);
}
示例6: GetBundle
private IResourceBundle GetBundle(TagModel model)
{
IResourceBundle bundle;
if (Bundle != null)
{
var bundleName = GetAsString(Bundle, model);
bundle = (IResourceBundle) model[bundleName];
if (bundle == null)
{
throw TagException.NoResourceBundleFoundUnder(bundleName).Decorate(Bundle.Context);
}
}
else
{
bundle = (IResourceBundle) model.SearchInTagScope(FormatConstants.BUNDLE);
bundle = bundle ?? (IResourceBundle) model.Global[FormatConstants.BUNDLE];
if (bundle == null)
{
throw TagException.NoResourceBundleFoundInTagScope().Decorate(Context);
}
}
return bundle;
}
示例7: GetMessage
public static object GetMessage(string key, TagModel model, params object[] replacements)
{
var bundle = (ResourceBundle) model.SearchInTagScope(FormatConstants.BUNDLE);
return bundle.Get(key, model);
}