Exemple #1
0
        public void receive()
        {
            // documentation example 1
            fake_headers_short headers = new fake_headers_short();
            receive r = new receive("swezataf3as5", JSONEncoders.EncodeJsString("definitly slightly positive"), headers.ToString());
            string expected = "[6,\"swezataf3as5\",\"definitly slightly positive\",0,{\"api_day_quota\":1000,\"api_day_reset\":41268740}]";
            string result = r.ToString();
            Assert.AreEqual(expected, result);

            // documentation example 2
            demo_object obj = new demo_object();
            r = new receive("ruvabras3ade", obj.ToString());
            expected = "[6,\"ruvabras3ade\",{\"deploy\":true,\"location\":2,\"changes\":392}]";
            result = r.ToString();
            Assert.AreEqual(expected, result);
        }
Exemple #2
0
 public void error()
 {
     // documentation example 1
     fake_headers_short headers = new fake_headers_short();
     error e = new error("8hewrafrey2z", new RPC_Exception(404, "method not found", "http://example.com/api/error#404"), headers.ToString());
     string expected = "[7,\"8hewrafrey2z\",[404,\"method not found\",\"http:\\/\\/example.com\\/api\\/error#404\"],{\"api_day_quota\":1000,\"api_day_reset\":41268740}]";
     string result = e.ToString();
     Assert.AreEqual(expected, result);
 }