Created
November 7, 2013 02:13
-
-
Save neil-s/7347810 to your computer and use it in GitHub Desktop.
Solve challenge at http://letsrevolutionizetesting.com/challenge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Newtonsoft.Json; | |
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Net; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace RevolutionizeTesting | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
bool patterncontinues = true; | |
String accessURL = "http://letsrevolutionizetesting.com/challenge?id=756775492"; | |
while (patterncontinues) | |
{ | |
int index = accessURL.IndexOf("?"); | |
accessURL = accessURL.Insert(index, ".json"); | |
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(accessURL); | |
HttpWebResponse response = (HttpWebResponse)request.GetResponse(); | |
TextReader reader = new StreamReader(response.GetResponseStream()); | |
String responseText = reader.ReadToEnd(); | |
Dictionary<String, String> responsedict = new Dictionary<string, string>(); | |
responsedict = JsonConvert.DeserializeObject<Dictionary<string, string>>(responseText); | |
try | |
{ | |
accessURL = responsedict["follow"]; | |
} | |
catch (KeyNotFoundException) | |
{ | |
patterncontinues = false; | |
Console.Write(responseText); | |
} | |
} | |
Console.ReadKey(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment