static void Main(string[] args)
        {
            var targetStoresInUSA = new List<Store>();

            StateURLCollection.URLs.ForEach(stateURL =>
            {
                var stateStoresDOM = CQ.CreateFromUrl(stateURL);
                var storeJSON = stateStoresDOM["#primaryJsonResponse"].Text();
                var state = JsonConvert.DeserializeObject<State>(storeJSON);
                targetStoresInUSA = targetStoresInUSA.Concat(state.Stores).ToList();
                Console.WriteLine("Processed: {0}", state.StateName);
            });

            var sodaClient = new SodaClient("opendata.socrata.com",
                ConfigurationManager.AppSettings["socrataAPIKey"],
                ConfigurationManager.AppSettings["socrataUsername"],
                ConfigurationManager.AppSettings["socrataPassword"]);

            var targetStoresInUSAJSON = JsonConvert.SerializeObject(targetStoresInUSA);
            Console.WriteLine("Upserting to Socrata");
            sodaClient.Upsert(targetStoresInUSAJSON, SodaDataFormat.JSON, ConfigurationManager.AppSettings["socrataResourceId"]);
        }
Esempio n. 2
0
 public void Upsert_With_String_And_SodaDataFormat_XML_Throws_ArgumentOutOfRangeException()
 {
     mockClient.Upsert(String.Empty, SodaDataFormat.XML, StringMocks.ResourceId);
 }
Esempio n. 3
0
 public void Upsert_With_String_And_SodaDataFormat_XML_Throws_ArgumentOutOfRangeException()
 {
     Assert.That(() => mockClient.Upsert(String.Empty, SodaDataFormat.XML, StringMocks.ResourceId), Throws.TypeOf <ArgumentOutOfRangeException>());
 }