public void TestNotFoundMonitor() { var app = DebuggerHelper.GetApplication(); var console = app.Make <HttpDebuggerConsole>(); var monitor = app.Make <IMonitor>(); App.Instance("DebuggerProvider.IndexMonitor", new List <string> { "titlenotfound", "title" }); var handler = new OnceRecordMonitorHandler("title", "ms", new[] { "tags" }, () => "helloworld"); monitor.Monitor(handler); string ret; var statu = HttpHelper.Get("http://localhost:9478/debug/monitor/get-monitors-index", out ret); console.Stop(); Assert.AreEqual(HttpStatusCode.OK, statu); Assert.AreEqual( "{\"Response\":[{\"name\":\"title\",\"value\":\"helloworld\",\"unit\":\"ms\",\"tags\":[\"tags\"]}]}", ret); }
public void TestRepeatRegisterMonitor() { var app = DebuggerHelper.GetApplication(); var console = app.Make <HttpDebuggerConsole>(); var monitor = app.Make <IMonitor>(); var handler = new OnceRecordMonitorHandler("title", "ms", new[] { "tags" }, () => "helloworld"); monitor.Monitor(handler); console.Stop(); ExceptionAssert.Throws <RuntimeException>(() => { monitor.Monitor(handler); }); }
public void TestForEachMonitor() { var app = DebuggerHelper.GetApplication(); var console = app.Make <HttpDebuggerConsole>(); var monitor = app.Make <MonitorStore>(); console.Stop(); var handler = new OnceRecordMonitorHandler("title", "ms", new[] { "tags" }, () => "helloworld"); monitor.Monitor(handler); foreach (var result in monitor) { Assert.AreEqual(handler, result); break; } }