public void StartServerAndCreateClient() { _server = new Server(18749); _server.OnGet("/foo").RespondWith("foo!"); _stopwatch = new Stopwatch(); _requestUri = new Uri(BaseAddress + "/foo"); }
public Form1() { InitializeComponent(); _context = SynchronizationContext.Current; string entropy = "?|2^&(*$:@!!*"; _oldUrl = OptionApi.GetString("SendLinkServiceUrl");//, _oldUrl); _oldDeviceToken = OptionApi.GetEncrypted("SendLinkDeviceToken", entropy); _oldLogin = OptionApi.GetString("SendLinkCloudStorageLoginName"); //, _oldLogin); _server = new Server(Constants.Port); _server.OnPost("/sign_ups.xml").Respond(OnRespond); _server.OnPost("/user_sessions.xml").Respond(OnRespond); _server.OnGet("/current_user.xml").Respond(OnRespond); _server.OnPost("/folders.xml").Respond(OnRespond); _server.OnPost(string.Format("/folders/{0}/members.xml", Constants.FolderId)).Respond(OnRespond); _server.OnPut(string.Format("/folders/{0}/permission.xml", Constants.FolderId)).Respond(OnRespond); _server.OnPut(string.Format("/folders/{0}.xml", Constants.FolderId)).Respond(OnRespond); _server.OnPost("/file_versions.xml").Respond(OnRespond); _server.OnPost("/aws").Respond(OnRespond); _server.OnPut(string.Format("/file_versions/{0}.xml", Constants.FileId)).Respond(OnRespond); _server.OnGet(string.Format("/files/{0}.xml", Constants.AnotherFileId)).Respond(OnRespond); _server.OnPost("/validations/current_user/resend.xml").Respond(OnRespond); }
public void SetUp() { Runner.SqlCompact(ConnectionString).Down(); Runner.SqlCompact(ConnectionString).Up(); _server = new Server(64978); _browser = new Browser(new LemonadeBootstrapper(), context => context.UserHostAddress("localhost")); }
public void SetUp() { _server = new Server(64978); Runner.SqlCompact(ConnectionString).Down(); Runner.SqlCompact(ConnectionString).Up(); _bootstrapper = new TestBootstrapper(); _browser = new Browser(_bootstrapper, context => context.UserHostAddress("TEST")); }
public void SetUp() { _createApplication = new CreateApplicationFake(); _getApplication = new GetApplicationByName(); _getFeature = new GetFeatureByNameAndApplication(); _server = new Server(64978); _testBootstrapper = new TestBootstrapper(); _browser = new Browser(_testBootstrapper, context => context.UserHostAddress("localhost")); Runner.SqlCompact(ConnectionString).Down(); Runner.SqlCompact(ConnectionString).Up(); }
public UnitTestSkyDoxServer(int port) { _server = new Server(port); _server.OnPost("/sign_ups.xml").Respond(OnPostSignUps); _server.OnPost("/user_sessions.xml").Respond(OnPostUserSessions); _server.OnGet("/current_user.xml").Respond(OnGetCurrentUser); _server.OnPost("/folders.xml").Respond(OnPostFolders); _server.OnPost(string.Format("/folders/{0}/members.xml", _folderId)).Respond(OnPostMembers); _server.OnPut(string.Format("/folders/{0}/permission.xml", _folderId)).Respond(OnPutPermissions); _server.OnPut(string.Format("/folders/{0}.xml", _folderId)).Respond(OnPutFolder); _server.OnPost("/validations/resend.xml").Respond(OnValidations); NextResponse = new Queue<MockResponse>(); Requests = new List<RequestPair>(); }
public CachingServer(int port) { _server = new Server(port); string path = "/" + Guid.NewGuid().ToString(); Url = "http://localhost:" + port + path; _version = 0; NumberOfRequests = 0; _server.OnGet(path).Respond((req, res) => { _version++; NumberOfRequests++; res.Headers["Cache-Control"] = CacheControl; res.Body = "request " + _version; }); }
public SelfishSite() { _server = new Server(); _server.OnGet("/").RespondWith("<html><head><title>Selfish has taken the stage</title></head><body>Howdy</body></html>"); _server.OnGet("/resource/bdd").RespondWith("bdd"); _server.OnGet("/auto_login").Respond((req, res) => { res.Headers["Set-Cookie"] = "username=bob"; }); _server.OnGet("/restricted_resource/bdd").Respond((req, res) => { if (req.Headers["Cookie"] == "username=bob") res.Body = "bdd"; }); }
public void StartServer() { ServerPort = Utility.ChooseRandomUnusedPort(); Console.WriteLine("Starting WDC server...."); if (this._server != null) { this._server.Stop(); } this._server = new SelfishHttp .Server(ServerPort); Console.WriteLine("Server listening on port " + ServerPort); this._server.OnPost("/next").Respond((req, res) => { var pageContent = req.BodyAs <string>(); var ajR = System.Web.Helpers.Json.Decode <AjRequestNext>(pageContent); var webReq = WebRequest.Create(ajR.Url); webReq.Proxy = null; webReq.Method = ajR.IsPostRequest ? "POST" : "GET"; webReq.ContentType = "application/x-www-form-urlencoded"; var reqData = Encoding.UTF8.GetBytes(ajR.PostData); webReq.ContentLength = reqData.Length; using (var reqStream = webReq.GetRequestStream()) reqStream.Write(reqData, 0, reqData.Length); using (var wres = webReq.GetResponse()) using (var resSteam = wres.GetResponseStream()) using (var sr = new StreamReader(resSteam)) { LsSiteRunners.Add(new SiteRunner(sr.ReadToEnd(), Project.SiteList.First(x => x.Id == ajR.TemplateId), this.ServerPort, Project.ScriptsPath)); } }); Console.WriteLine("provide starting url to server to start the crawler"); PostAsync("http://localhost:" + this.ServerPort + "/next", Json.Encode(this.StartUrl)); }
public MockServer(int port) { _server = new Server(port); _server.OnPost("/sign_ups.xml").Respond(OnRespond); _server.OnPost("/user_sessions.xml").Respond(OnRespond); _server.OnGet("/current_user.xml").Respond(OnRespond); _server.OnPost("/folders.xml").Respond(OnRespond); _server.OnPost(string.Format("/folders/{0}/members.xml", Constants.FolderId)).Respond(OnRespond); _server.OnPut(string.Format("/folders/{0}/permission.xml", Constants.FolderId)).Respond(OnRespond); _server.OnPut(string.Format("/folders/{0}.xml", Constants.FolderId)).Respond(OnRespond); _server.OnPost("/file_versions.xml").Respond(OnRespond); _server.OnPost("/aws").Respond(OnRespond); _server.OnPut(string.Format("/file_versions/{0}.xml", Constants.FileId)).Respond(OnRespond); _server.OnGet(string.Format("/files/{0}.xml", Constants.AnotherFileId)).Respond(OnRespond); _server.OnPost("/validations/current_user/resend.xml").Respond(OnRespond); }
public void StartServerAndCreateClient() { _server = new Server(18745); _server.OnGet("/foo").RespondWith("foo!"); _server.OnGet("/foo/bar").RespondWith("foo bar?"); _client = new RestClient(BaseAddress); }
public void StartServer() { _server = new Server(18749); }
public void StartServer() { _server = new Server(18754); _server.OnGet("/accept").Respond((req, res) => res.Body = "Body"); _server.OnGet("/sleep").Respond(SleepForASecond); }