Exemple #1
0
        public static void Test()
        {
            var s = new JsonSerializer("yyyy-MM-dd");
            var v = s.ReadObject <JsonTestObject>(@"{""time"": ""03:53:25 AM"",""milliseconds_since_epoch"": 1362196405309,""date"": ""2013-02-23""}");

            v.Properties.Add("x", DateTime.Now);
            v.Data.Add(42);
            v.Data.Add("oops");
            var m = new System.IO.MemoryStream();

            s.WriteObject(m, v);//{ "data":[42,"oops"],"date":"2013-02-23","milliseconds_since_epoch":1362196405309,"properties":{"x":"2016-12-28"},"time":"03:53:25 AM"}
            m.Position = 0;
            var sss = m.GetBuffer().GetString();

            v = s.ReadObject <JsonTestObject>(m);
            v = new HttpClientEx()
            {
                JsonSerializer = new JsonSerializer("MM-dd-yyyy")
            }.Get <JsonTestObject>("http://date.jsontest.com/");
            v = new HttpWebRequestClient()
            {
                JsonSerializer = new JsonSerializer("MM-dd-yyyy")
            }.Get <JsonTestObject>("http://date.jsontest.com/");
        }
Exemple #2
0
        public static IAIntAirAct New()
        {
            // don't mess with the order here, TinyIoC is very picky about it
            TinyIoCContainer container = TinyIoCContainer.Current;
            NancyServerAdapter adapter = new NancyServerAdapter();
            Owin.AppDelegate app = Gate.Adapters.Nancy.NancyAdapter.App();
            adapter.App = app;
            IAClient client = new HttpWebRequestClient();

            // register the server adapter for the module serving the routes
            container.Register<NancyServerAdapter>(adapter);

            IAIntAirAct intAirAct = new IAIntAirAct(adapter, client);

            // register IntAirAct for getting the origin devices in NancyModule
            container.Register<IAIntAirAct>(intAirAct);

            return intAirAct;
        }