public void TestGetOfMessageNoBundle()
        {
            var model = new TagModel(new object(), new MockSessionState());
            var tag   = new Message();

            tag.Key = new MockAttribute(new Constant("c"));
            try
            {
                tag.Evaluate(model);
                Assert.Fail("Expected exception");
            } catch (TagException Te)
            {
                Assert.That(TagException.NoResourceBundleFoundInTagScope().Message,
                            Is.EqualTo(Te.MessageWithOutContext));
            }
        }
Exemple #2
0
        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);
        }