Beispiel #1
0
        public void TestAutoDetection()
        {
            var xml  = "<message><content>Hello world!</content></message>";
            var json = "{\"message\": { \"content\": \"Hello world!\"} }";
            var yaml = "---\nmessage:\n  content: Hello world!";

            DataFormat format;

            format = DataFormats.DetectFormat(xml);
            Assert.IsTrue(format.Equals(DataFormat.XML));

            format = DataFormats.DetectFormat(json);
            Assert.IsTrue(format.Equals(DataFormat.JSON));

            format = DataFormats.DetectFormat(yaml);
            Assert.IsTrue(format.Equals(DataFormat.YAML));
        }