Пример #1
0
        public void ConvertBasicBadXml()
        {
            var sourceXml = "<title>Test title</title><text>Test text</text>";

            var converter = new XmlToJsonConvertorService();

            Assert.Throws <ParsingInputFileException>(() => converter.Convert(sourceXml));
        }
Пример #2
0
        public void ConvertBasicTest()
        {
            var sourceXml    = "<testdata><title>Test title</title><text>Test text</text></testdata>";
            var expectedJson = "{\"Title\":\"Test title\",\"Text\":\"Test text\"}";

            var converter  = new XmlToJsonConvertorService();
            var resultJson = converter.Convert(sourceXml);

            Assert.AreEqual(expectedJson, resultJson);
        }