Esempio n. 1
0
 public virtual void TestSetScriptSrc()
 {
     HamletSpec.SCRIPT script = Org.Mockito.Mockito.Mock <HamletSpec.SCRIPT>();
     HamletImpl.SetScriptSrc(script, "uri");
     HamletImpl.SetScriptSrc(script, "script.js");
     Org.Mockito.Mockito.Verify(script).$src("uri");
     Org.Mockito.Mockito.Verify(script).$type("text/javascript");
     Org.Mockito.Mockito.Verify(script).$src("script.js");
     Org.Mockito.Mockito.VerifyNoMoreInteractions(script);
 }
Esempio n. 2
0
 public virtual void TestSetLinkHref()
 {
     HamletSpec.LINK link = Org.Mockito.Mockito.Mock <HamletSpec.LINK>();
     HamletImpl.SetLinkHref(link, "uri");
     HamletImpl.SetLinkHref(link, "style.css");
     Org.Mockito.Mockito.Verify(link).$href("uri");
     Org.Mockito.Mockito.Verify(link).$rel("stylesheet");
     Org.Mockito.Mockito.Verify(link).$href("style.css");
     Org.Mockito.Mockito.VerifyNoMoreInteractions(link);
 }
Esempio n. 3
0
 internal EImp(HamletImpl _enclosing, string name, T parent, EnumSet <HamletImpl.EOpt
                                                                      > opts)
 {
     this._enclosing = _enclosing;
     // number of indent() called. mostly for testing.
     // not shared
     // short cut for parent element
     // element options
     this.name   = name;
     this.parent = parent;
     this.opts   = opts;
 }
Esempio n. 4
0
 public virtual void TestSetSelector()
 {
     HamletSpec.CoreAttrs e = Org.Mockito.Mockito.Mock <HamletSpec.CoreAttrs>();
     HamletImpl.SetSelector(e, "#id.class");
     Org.Mockito.Mockito.Verify(e).$id("id");
     Org.Mockito.Mockito.Verify(e).$class("class");
     HamletSpec.H1 t = Org.Mockito.Mockito.Mock <HamletSpec.H1>();
     HamletImpl.SetSelector(t, "#id.class").("heading");
     Org.Mockito.Mockito.Verify(t).$id("id");
     Org.Mockito.Mockito.Verify(t).$class("class");
     Org.Mockito.Mockito.Verify(t).("heading");
 }
Esempio n. 5
0
        public virtual void TestGeneric()
        {
            PrintWriter @out = Org.Mockito.Mockito.Spy(new PrintWriter(System.Console.Out));
            HamletImpl  hi   = new HamletImpl(@out, 0, false);

            hi.Root("start")._attr("name", "value").("start text").Elem("sub")._attr("name",
                                                                                     "value").("sub text").().Elem("sub1")._noEndTag()._attr("boolean", null).("sub1text"
                                                                                                                                                               ).().("start text2").Elem("pre")._pre().("pre text").Elem("i")._inline().("inline"
                                                                                                                                                                                                                                         ).().().Elem("i")._inline().("inline after pre").().("start text3").Elem("sub2")
            .("sub2text").().Elem("sub3")._noEndTag().("sub3text").().Elem("sub4")._noEndTag
                ().Elem("i")._inline().("inline").().("sub4text").().();
            @out.Flush();
            NUnit.Framework.Assert.AreEqual(0, hi.nestLevel);
            NUnit.Framework.Assert.AreEqual(20, hi.indents);
            Org.Mockito.Mockito.Verify(@out).Write("<start");
            Org.Mockito.Mockito.Verify(@out, Org.Mockito.Mockito.Times(2)).Write(" name=\"value\""
                                                                                 );
            Org.Mockito.Mockito.Verify(@out).Write(" boolean");
            Org.Mockito.Mockito.Verify(@out).Write("</start>");
            Org.Mockito.Mockito.Verify(@out, Org.Mockito.Mockito.Never()).Write("</sub1>");
            Org.Mockito.Mockito.Verify(@out, Org.Mockito.Mockito.Never()).Write("</sub3>");
            Org.Mockito.Mockito.Verify(@out, Org.Mockito.Mockito.Never()).Write("</sub4>");
        }
Esempio n. 6
0
 internal Generic(HamletImpl _enclosing, string name, T parent, EnumSet <HamletImpl.EOpt
                                                                         > opts)
     : base(_enclosing)
 {
     this._enclosing = _enclosing;
 }
Esempio n. 7
0
 public virtual void TestNormal()
 {
     string[] res = HamletImpl.ParseSelector("#id.class");
     NUnit.Framework.Assert.AreEqual("id", res[SId]);
     NUnit.Framework.Assert.AreEqual("class", res[SClass]);
 }
Esempio n. 8
0
 public virtual void TestMissingAll()
 {
     HamletImpl.ParseSelector(string.Empty);
 }
Esempio n. 9
0
 public virtual void TestMissingClass()
 {
     string[] res = HamletImpl.ParseSelector("#id");
     NUnit.Framework.Assert.AreEqual("id", res[SId]);
     NUnit.Framework.Assert.IsNull(res[SClass]);
 }