コード例 #1
0
ファイル: SetBundleTest.cs プロジェクト: rslijp/sharptiles
 public void CheckLoadingOfSetBundle()
 {
     var model = new TagModel(new Hashtable());
     var tag = new SetBundle();
     tag.BaseName = new MockAttribute(new Constant("FormatTags/test"));
     tag.Var = new MockAttribute(new Constant("myBundle"));
     Assert.That(tag.Evaluate(model), Is.EqualTo(String.Empty));
     Assert.That(model.Page["myBundle"], Is.Not.Null);
     Assert.That(model.Page["myBundle"] is ResourceBundle, Is.True);
     var bundle = (ResourceBundle) model.Page["myBundle"];
     Assert.That(bundle.BaseName, Is.EqualTo("FormatTags/test"));
 }
コード例 #2
0
ファイル: SetBundleTest.cs プロジェクト: rslijp/sharptiles
 public void TestSettingOfScope()
 {
     var model = new TagModel(new Hashtable(), new MockSessionState());
     var tag = new SetBundle();
     tag.BaseName = new MockAttribute(new Constant("FormatTags/test"));
     tag.Var = new MockAttribute(new Constant("myBundle"));
     tag.Scope = new MockAttribute(new Constant(VariableScope.Session.ToString()));
     Assert.That(tag.Evaluate(model), Is.EqualTo(String.Empty));
     Assert.That(model.Page["myBundle"], Is.Null);
     Assert.That(model.Session["myBundle"], Is.Not.Null);
     Assert.That(model.Session["myBundle"] is ResourceBundle, Is.True);
     var bundle = (ResourceBundle) model.Session["myBundle"];
     Assert.That(bundle.BaseName, Is.EqualTo("FormatTags/test"));
 }
コード例 #3
0
ファイル: SetBundleTest.cs プロジェクト: rslijp/sharptiles
 public void CheckRequired()
 {
     var tag = new SetBundle();
     try
     {
         RequiredAttribute.Check(tag);
         Assert.Fail("Expected Exception");
     }
     catch (TagException Te)
     {
         Assert.That(Te.Message,
                     Is.EqualTo(
                         TagException.MissingRequiredAttribute(typeof (SetBundle), "BaseName", "Var").Message));
     }
     tag.BaseName = new MockAttribute(new Constant("a"));
     tag.Var = new MockAttribute(new Constant("a"));
     RequiredAttribute.Check(tag);
 }