Ejemplo n.º 1
0
        public void Can_Serialize_ScriptLocations()
        {
            var xns = new XmlSerializerNamespaces();
            xns.Add("", "");
            var v = new Variable { Key = "var1", DefaultValue = "somestring" };
            var s = new Script { ScriptName = "test" };
            s.Variables.Add(v);

            var sl = new ScriptLocation
                {
                    Path = "..\\Some\\Path",
                    Recursive = false,
                    RunOnce = true,
                };
            sl.Scripts.Add(s);
            sl.Scripts.Add(s);
            sl.Scripts.Add(s);

            var xs = new XmlSerializer(typeof(ScriptLocation));
            var sb = new StringBuilder();
            var sw = new StringWriter(sb);
            xs.Serialize(sw, sl,xns);

            Debug.WriteLine(sb.ToString());
            Assert.AreEqual(strScriptLocationsXml, sb.ToString());
        }
Ejemplo n.º 2
0
        public void Can_Serialize_Variable()
        {
            var xns = new XmlSerializerNamespaces();
            xns.Add("","");
            var v = new Variable { Key = "var1", DefaultValue = "somestring" };
            var xs = new XmlSerializer(typeof(Variable));
            var sb = new StringBuilder();
            var sw = new StringWriter(sb);
            xs.Serialize(sw, v, xns);

            Debug.WriteLine(sb.ToString());
            Assert.AreEqual(strVariableXml, sb.ToString());
        }
Ejemplo n.º 3
0
        public void Can_Serialize_Script()
        {
            var xns = new XmlSerializerNamespaces();
            xns.Add("", "");
            var v = new Variable { Key = "var1", DefaultValue = "somestring" };
            var s = new Script {ScriptName = "test"};
            s.Variables.Add(v);
            s.Variables.Add(v);
            s.Variables.Add(v);

            var xs = new XmlSerializer(typeof(Script));
            var sb = new StringBuilder();
            var sw = new StringWriter(sb);
            xs.Serialize(sw, s, xns);

            Debug.WriteLine(sb.ToString());
            Assert.AreEqual(strScriptXml, sb.ToString());
        }