public void TestCleanup() { // stop and dispose the web server if it's running if (WebServer != null) { WebServer.Dispose(); } }
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(); }
private static void Stop() { server.StopServer(); server.Dispose(); }