Example #1
0
        public IDecoder GetDecoder()
        {
            var jsonReader = new JsonReader(new DataReaderSettings(DefaultEncoderDecoderConfiguration.CombinedResolverStrategy()
                                                                   , new TeamCityDateFilter()), new[] { "application/.*json", "text/.*json" });

            var readers = new List <IDataReader> {
                jsonReader
            };
            var dataReaderProvider = new RegExBasedDataReaderProvider(readers);

            return(new DefaultDecoder(dataReaderProvider));
        }
Example #2
0
            public void BecauseOf()
            {
                input =
                    "[{\"intAuthorID\":\"8\",\"strText\":\"test1\"},{\"intAuthorID\":\"5\",\"strText\":\"This message\"}]";

                IEnumerable <IDataReader> readers = new List <IDataReader>
                {
                    new JsonReader(
                        new DataReaderSettings(DefaultEncoderDecoderConfiguration.CombinedResolverStrategy()),
                        "application/.*json")
                };

                decoder = new DefaultDecoder(new RegExBasedDataReaderProvider(readers));
            }
Example #3
0
            public void BecauseOf()
            {
                input =
                    "{\"html_attributions\": [],\"result\": {\"address_components\": [{\"long_name\": \"Church Street\",\"short_name\": \"Church Street\",\"types\": [\"route\"]},{\"long_name\": \"Wilmslow\",\"short_name\": \"Wilmslow\",\"types\": [\"locality\",\"political\"]},{\"long_name\": \"GB\",\"short_name\": \"GB\",\"types\": [\"country\",\"political\"]},{\"long_name\": \"SK9 1\",\"short_name\": \"SK9 1\",\"types\": [\"postal_code\"]}],\"formatted_address\": \"Church Street, Wilmslow, SK9 1, United Kingdom\",\"formatted_phone_number\": \"01625 538831\",\"geometry\": {\"location\": {\"lat\": 53.328908,\"lng\": -2.229191}},\"icon\": \"http://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png\",\"id\": \"51155a69bc03041b926e44f03a5bbe9feafb5035\",\"international_phone_number\": \"+44 1625 538831\",\"name\": \"Waitrose\",\"reference\": \"CmRfAAAAUZ4dYk9VpNJd1mFxa970TxVGgp9QTGeEa1BaU_wTWdTHNLCcB-9YyNu5LjgIewxo_oOna0KI9f_Z-Xff4CxvTf9wFHTHgE1wRGyCLLJo2BPjkGHo5Qem-Z-2_FKiY3gmEhA_Qs0jcQyFgVEs1BZAt_bdGhRerV30JziD2x7ZOMgxQTKlnH0yAQ\",\"types\": [\"grocery_or_supermarket\",\"food\",\"store\",\"establishment\"],\"url\": \"http://maps.google.com/maps/place?cid=14979720525476796445\",\"vicinity\": \"Church Street, Wilmslow\",\"website\": \"http://www.waitrose.com/wilmslow\"},\"status\": \"OK\"}";

                IEnumerable <IDataReader> readers = new List <IDataReader>
                {
                    new JsonReader(
                        new DataReaderSettings(DefaultEncoderDecoderConfiguration.CombinedResolverStrategy()),
                        "application/.*json")
                };

                decoder = new DefaultDecoder(new RegExBasedDataReaderProvider(readers));
            }
Example #4
0
            public void BecauseOf()
            {
                input = "{\"LockedOutUntil\":\"/Date(1289073014137)/\"}";

                IEnumerable <IDataReader> readers = new List <IDataReader>
                {
                    new
                    JsonReader(new DataReaderSettings(DefaultEncoderDecoderConfiguration.CombinedResolverStrategy(),
                                                      new MSAjaxDateFilter(),
                                                      new Iso8601DateFilter()
                                                      ), "application/.*json")
                };

                decoder = new DefaultDecoder(new RegExBasedDataReaderProvider(readers));
            }
        public IEncoder GetEncoder()
        {
            var jsonWriter =
                new CamelCaseJsonWriter(new DataWriterSettings(DefaultEncoderDecoderConfiguration.CombinedResolverStrategy()
                                                               , new TeamCityDateFilter()), "application/.*json", "text/.*json");

            var writers = new List <IDataWriter> {
                jsonWriter
            };
            var dataWriterProvider = new RegExBasedDataWriterProvider(new List <IDataWriter> {
                jsonWriter
            });

            return(new DefaultEncoder(dataWriterProvider));
        }