Example #1
0
        public void SerializeAndDeserializeTagList()
        {
            IList <Tag> tl = new List <Tag>();

            tl.Add(new Tag {
                Label = "No!", Uri = new Uri("http://www.nu.nl/tags")
            });
            tl.Add(new Tag {
                Label = "Maybe", Uri = new Uri("http://www.furore.com/tags")
            });

            string json = FhirSerializer.SerializeTagListToJson(tl);

            Assert.AreEqual(jsonTagList, json);

            string xml = FhirSerializer.SerializeTagListToXml(tl);

            Assert.AreEqual(xmlTagList, xml);

            ErrorList errors = new ErrorList();

            tl = FhirParser.ParseTagListFromXml(xml, errors);
            Assert.IsTrue(errors.Count == 0, errors.ToString());
            verifyTagList(tl);

            tl = FhirParser.ParseTagListFromJson(json, errors);
            Assert.IsTrue(errors.Count == 0, errors.ToString());
            verifyTagList(tl);
        }
Example #2
0
        public void SerializeAndDeserializeTagList()
        {
            TagList tl = new TagList();

            tl.Category.Add(new Tag("http://www.nu.nl/tags", Tag.FHIRTAGSCHEME_GENERAL, "No!"));
            tl.Category.Add(new Tag("http://www.furore.com/tags", Tag.FHIRTAGSCHEME_GENERAL, "Maybe, indeed"));

            string json = FhirSerializer.SerializeTagListToJson(tl);

            Assert.AreEqual(jsonTagList, json);

            string xml = FhirSerializer.SerializeTagListToXml(tl);

            Assert.AreEqual(xmlTagList, xml);


            tl = FhirParser.ParseTagListFromXml(xml);
            verifyTagList(tl.Category);

            tl = FhirParser.ParseTagListFromJson(json);
            verifyTagList(tl.Category);
        }