public void NoUrlSupplied() { HttpContentToSend content = new HttpContentToSend(); HttpRequestInfo requestInfo = new HttpRequestInfo(string.Empty, RequestType.Get, content); HttpRunner.SendHttpRequest(requestInfo); }
[Test] public void ExecutesAPlainTextTest() { var server = new Server { Request = "fitLibrary.DoFixture\n" }; var runner = new HttpRunner(server); runner.Run(null, new TypeDictionary(), null); Assert.AreEqual("test@<br /><div><table><tr><td><span class=\"fit_interpreter\">fitLibrary.DoFixture</span></td> </tr></table></div>", server.Reply); }
[Test] public void DoesntExecuteAnExitCommand() { var server = new Server { Request = "exit" }; var runner = new HttpRunner(server); runner.Run(null, new TypeDictionary(), null); Assert.AreEqual("Bye", server.Reply); }
/// <summary> /// Gets a list of all the devices and their information from Device42 /// </summary> /// <returns>Json string of all the devices and their information</returns> /// <exception cref="RequestFailedException">The http request failed while trying to get the device list</exception> public override string Execute() { responseText = string.Empty; HttpRequestInfo requestData = null; requestData = new HttpRequestInfo( string.Concat(serverAddress, D42URLs.AllDevices) , RequestType.Get , authHeader ); try{ responseText = HttpRunner.SendHttpRequest(requestData); }catch (Exception excep) { throw new RequestFailedException("Request to get all devices failed", excep); } return(responseText); }
/// <summary> /// Gets a list of all the passwords and their information from Device42 /// </summary> /// <returns>Json string of all the passwords and their information</returns> /// <exception cref="RequestFailedException">The http request failed while trying to get the device list</exception> public override string Execute() { responseText = string.Empty; HttpRequestInfo requestData = null; requestData = new HttpRequestInfo( string.Concat(serverAddress, D42URLs.GetPasswords) , RequestType.Get , new HttpContentToSend(commandParameters, Encoding.UTF8, ContentType.GetForm) , authHeader ); // Reset commandParameters so the aren't reused commandParameters = string.Empty; try{ responseText = HttpRunner.SendHttpRequest(requestData); }catch (Exception excep) { throw new RequestFailedException("Request to get passwords failed", excep); } return(responseText); }