예제 #1
0
        public void TestEmptyParameterGroup()
        {
            ParameterGroup sparam     = new ParameterGroup(new Parameter[0], "myname", false);
            StringWriter   writer     = new StringWriter();
            XmlSerializer  serializer = new XmlSerializer(sparam.GetType());

            serializer.Serialize(writer, sparam);
            StringReader   writer2 = new StringReader(writer.ToString());
            ParameterGroup sparam2 = (ParameterGroup)serializer.Deserialize(writer2);

            Assert.AreEqual(sparam.Name, sparam2.Name);
        }
예제 #2
0
        public void TestParameterGroup()
        {
            ParameterGroup sparam     = new ParameterGroup(new Parameter[] { new IntParam("int", 42), new StringParam("string", "42") }, "myname", false);
            StringWriter   writer     = new StringWriter();
            XmlSerializer  serializer = new XmlSerializer(sparam.GetType());

            serializer.Serialize(writer, sparam);
            StringReader   writer2 = new StringReader(writer.ToString());
            ParameterGroup sparam2 = (ParameterGroup)serializer.Deserialize(writer2);

            Assert.AreEqual(sparam.Name, sparam2.Name);
            Assert.AreEqual(42, ((IntParam)sparam[0]).Value);
            Assert.AreEqual("42", ((StringParam)sparam[1]).Value);
        }