private void InitializePubComboBox() { Channel ch = new Channel(); string token = TokenStore.getTokenFromStore(); ch.setAuthToken(token); JArray d = ch.getAllBroadcastsChannels(); //Need User ID to send into filterPermittedChannels JArray datafeed = ch.filterChannelsInBroadcast(d); if (datafeed.ToString() != "[]") { foreach (dynamic data in datafeed) { foreach (dynamic c in data.channels) { pubComboBox.Items.Add(c.id.ToString() + "-" + c.description.ToString()); } } } else { pubComboBox.Items.Add("No data in the channel"); pubComboBox.SelectedIndex = 0; } }
public void GetAllChannelsTest() { using (ShimsContext.Create()) { var responseStream = new FileStream("Fixtures/v1.channels.index.response", FileMode.Open); var responseShim = new ShimHttpWebResponse() { GetResponseStream = () => responseStream }; String actualMethod = ""; var requestShim = new ShimHttpWebRequest() { MethodSetString = (method) => { actualMethod = method; }, GetResponse = () => responseShim }; String actualURL = ""; ShimWebRequest.CreateString = (url) => { actualURL = url; return requestShim; }; Channel ch = new Channel(); JArray json = ch.getAllBroadcastsChannels(); StringAssert.AreEqualIgnoringCase("GET", actualMethod); StringAssert.AreEqualIgnoringCase("http://panoply-staging.herokuapp.com/api/channels.json", actualURL); Assert.AreEqual(2, json.Count); } }
static void Main(string[] args) { Channel ch = new Channel(); string token = ch.getToken("*****@*****.**", "password"); ch.setAuthToken(token); string response = ch.getAllBroadcastsChannels().ToString(); //string token = ch.getToken("*****@*****.**", "password"); //Console.Write("Token from Website: " + token + "\n"); //at.setToken(token); //at.createCookieInContainer(); //string txt = at.readTokenFromCookie(); //Console.Write("Cookie Token: " + txt + "\n"); Console.Write(response); Console.Read(); }