public void CheckNetLatency() { Console.WriteLine("Checking .net latency"); var server = new CassiniDevServer(); server.StartServer(Environment.CurrentDirectory); var ctx = new Client(new Uri(server.NormalizeUrl("/")), new Uri(server.NormalizeUrl("/")), "foo"); DateTimeOffset requestRecieved = DateTimeOffset.MinValue; RequestCompletedEventArgs requestInfo = null; ctx.RequestCompleted += (i, e) => { requestInfo = e; }; server.Server.ProcessRequest += (i, e) => { e.Continue = false; e.Response = LoggedIn; e.ResponseStatus = 200; requestRecieved = DateTimeOffset.UtcNow; }; try { ctx.LogIn(Settings.RpcUserName, Settings.RpcPassword); } finally { server.Dispose(); } Console.WriteLine("elapsed {0}", requestInfo.Info.Watch.ElapsedMilliseconds); // #TODO: not sure i like the complete removal of temporal data //Console.WriteLine("issued {0}", requestInfo.Info.Issued.Ticks); //Console.WriteLine("recieved {0}", requestRecieved.Ticks); //Console.WriteLine("competed {0}", requestInfo.Info.Completed.Ticks); //Console.WriteLine("issued to recieved {0}", TimeSpan.FromTicks(requestRecieved.Ticks - requestInfo.Info.Issued.Ticks)); //Console.WriteLine("recieved to completed {0}", TimeSpan.FromTicks(requestInfo.Info.Completed.Ticks - requestRecieved.Ticks)); //Console.WriteLine("issued to completed {0}", TimeSpan.FromTicks(requestInfo.Info.Completed.Ticks - requestInfo.Info.Issued.Ticks)); Assert.IsNotNullOrEmpty(ctx.Session); ctx.Dispose(); }
public void RootPage_LoadsSuccesfully() { string url = _server.NormalizeUrl("/"); var client = new WebClient(); var result = client.DownloadString(url); Assert.IsTrue(result.Contains("<h2>Index</h2>")); }
public void TestMethod1() { var server = new CassiniDevServer(); server.StartServer(Environment.CurrentDirectory); var url = server.NormalizeUrl("test-page.htm"); WebClient client = new WebClient(); var response = client.DownloadString(url); Assert.IsTrue(response.Contains("test page")); server.StopServer(); }
public Form1() { InitializeComponent(); _server = new CassiniDevServer(); // our content is Copy Always into bin _server.StartServer(Path.Combine(Environment.CurrentDirectory, "WebContent")); _webBrowser1.Navigate(_server.NormalizeUrl("Default.aspx")); }
public void Example1() { CassiniDevServer server = new CassiniDevServer(); server.StartServer(Path.Combine(Environment.CurrentDirectory, @"..\..\..\CassiniDevHostingExample")); string url = server.NormalizeUrl("/"); Console.WriteLine(url); var dom = CsQuery.Server.CreateFromUrl(url); Console.WriteLine(dom.Text()); StringAssert.Contains("Welcome to ASP.NET MVC!", dom.Text()); }