/// <exception cref="System.IO.IOException"/> public virtual void TestPrintMap() { StringWriter sw = new StringWriter(); PrintWriter @out = new PrintWriter(sw); MetricsServlet servlet = new MetricsServlet(); servlet.PrintMap(@out, servlet.MakeMap(contexts)); string Expected = string.Empty + "test1\n" + " testRecord\n" + " {testTag1=testTagValue1,testTag2=testTagValue2}:\n" + " testMetric1=1\n" + " testMetric2=33\n" + "test2\n"; Assert.Equal(Expected, sw.ToString()); }
/// <exception cref="System.IO.IOException"/> public virtual void TestGetMap() { MetricsServlet servlet = new MetricsServlet(); IDictionary <string, IDictionary <string, IList <MetricsServlet.TagsMetricsPair> > > m = servlet.MakeMap(contexts); Assert.Equal("Map missing contexts", 2, m.Count); Assert.True(m.Contains("test1")); IDictionary <string, IList <MetricsServlet.TagsMetricsPair> > m2 = m["test1"]; Assert.Equal("Missing records", 1, m2.Count); Assert.True(m2.Contains("testRecord")); Assert.Equal("Wrong number of tags-values pairs.", 1, m2["testRecord" ].Count); }