public void PerceptCollectionWriter_XmlOfPerceptCollectionWithTwoPercepts_ReturnPerceptCollectionWithTwoChildren()
        {
            IilPerceptCollection actual_src = new IilPerceptCollection(new IilPercept("percept1", new IilNumeral(42)),
                                                                       new IilPercept("percept2", new IilIdentifier("id"))
                );

            StringBuilder sb = new StringBuilder();

            XmlSerializer serializer = new XmlSerializer(typeof (IilPerceptCollection));
            serializer.Serialize(XmlWriter.Create(sb), actual_src);

            XDocument expected = XDocument.Parse(
                @"<?xml version=""1.0"" encoding=""utf-16""?>
                <perceptCollection>
                    <percept name=""percept1"">
                        <perceptParameter>
                            <number value=""42"" />
                        </perceptParameter>
                    </percept>
                    <percept name=""percept2"">
                        <perceptParameter>
                            <identifier value=""id"" />
                        </perceptParameter>
                    </percept>
                </perceptCollection>"
                );

            XDocument actual = XDocument.Parse(sb.ToString());

            Assert.AreEqual(expected.ToString(), actual.ToString());
        }
        public void PerceptCollectionWriter_XmlOfPerceptCollectionWithNoPercepts_ReturnEmptyPerceptCollection()
        {
            IilPerceptCollection actual_src = new IilPerceptCollection();

            StringBuilder sb = new StringBuilder();

            XmlSerializer serializer = new XmlSerializer(typeof(IilPerceptCollection));
            serializer.Serialize(XmlWriter.Create(sb), actual_src);

            XDocument expected = XDocument.Parse(
                @"<?xml version=""1.0"" encoding=""utf-16""?>
                <perceptCollection/>"
                );

            XDocument actual = XDocument.Parse(sb.ToString());

            Assert.AreEqual(expected.ToString(), actual.ToString());
        }
        public void TryReadXmlRepresentationOfPerceptCollection_PerceptCollection()
        {
            XmlSerializer serializer = new XmlSerializer(typeof (IilPerceptCollection));

            IilPerceptCollection expected = new IilPerceptCollection (new IilPercept ("test", new IilNumeral (2.0)));

            XElement actual_src = XElement.Parse (
                @"<perceptCollection>
                    <percept name=""test"">
                        <perceptParameter>
                            <number value=""2.0"" />
                        </perceptParameter>
                    </percept>
                </perceptCollection>");

            IilPerceptCollection actual = (IilPerceptCollection) serializer.Deserialize(actual_src.CreateReader());

            Assert.AreEqual (expected, actual);
        }