public void FromXmlToJSONTest()
        {
            string input = "<response>\n  <status>SUCCESS</status>\n  <statusCode>2000</statusCode>\n  " +
                           "<id>1</id>\n  <name>rafa</name>\n  <surname>nadal</surname>\n</response>";


            //string output = "{\n  \"status\": \"SUCCESS\",\n  \"statusCode\": \"2000\",\n  \"id\": \"1\",\n  \"name\": \"rafa\",\n  \"surname\": \"nadal\"\n}";

            string output = "{\n  \"status\": " + "\"SUCCESS\",\n  " +
                            "\"statusCode\": " + "\"2000\",\n  " +
                            "\"id\": " + "\"1\",\n  " +
                            "\"name\": " + "\"rafa\",\n  " +
                            "\"surname\": " + "\"nadal\"\n}";

            var        pom  = new Mock <IXmlAdapter>();
            XmlAdapter xmla = new XmlAdapter(pom.Object);

            Assert.AreEqual(output, xmla.FromXmlToJSON(input));
        }
示例#2
0
 public ComBus(IComBus iComBus)
 {
     xml      = new XmlAdapter();
     db       = new XmlToDB();
     myComBus = iComBus;
 }