Exemplo n.º 1
0
        public void Render()
        {
            SetPropertyAction a = new SetPropertyAction();
            StringWriter      sw;
            ScriptTextWriter  w;

            // test an empty action
            sw = new StringWriter();
            w  = new ScriptTextWriter(sw);
            a.RenderAction(w);

            Assert.AreEqual("<setProperty />", sw.ToString(), "A1");

            // test with a property
            a.Target      = "target";
            a.Property    = "property";
            a.PropertyKey = "propertyKey";
            a.Value       = "value";

            sw = new StringWriter();
            w  = new ScriptTextWriter(sw);
            a.RenderAction(w);

            Assert.AreEqual("<setProperty target=\"target\" property=\"property\" propertyKey=\"propertyKey\" value=\"value\" />", sw.ToString(), "A2");

            // test with a target and id
            a.ID          = "set_id";
            a.Target      = "target";
            a.Property    = "property";
            a.PropertyKey = "propertyKey";
            a.Value       = "value";

            sw = new StringWriter();
            w  = new ScriptTextWriter(sw);
            a.RenderAction(w);

            Assert.AreEqual("<setProperty id=\"set_id\" target=\"target\" property=\"property\" propertyKey=\"propertyKey\" value=\"value\" />", sw.ToString(), "A3");
        }