Example #1
0
 public void EndEntryTest()
 {
     var target = new Trace_Accessor();
     string description = "Entry description.";
     severityType severity = severityType.INFO;
     IDictionary<string, object> properties = new Dictionary<String, Object>() { { "prop1", "asd" } };
     Entry expected = new Entry(description, severity);
     Entry actual = target.BeginEntry(description, severity, properties);
     Thread.Sleep(10);
     target.EndEntry();
     Assert.IsTrue(actual.Offset >= 0);
     Assert.IsTrue(actual.Duration > 0);
 }
Example #2
0
 public void BeginEntryTest()
 {
     var target = new Trace_Accessor();
     string description = "Entry description.";
     severityType severity = severityType.INFO;
     IDictionary<string, object> properties = new Dictionary<String, Object>() { { "prop1", "asd" } };
     Entry expected = new Entry(description, severity);
     Entry actual = target.BeginEntry(description, severity, properties);
     // Align offsets witch isn't predictable
     expected.Offset = actual.Offset;
     Assert.AreEqual(expected, actual);
     Assert.IsTrue(target.Context.Count == 1);
     Assert.AreEqual(expected, target.Context.Peek());
 }
Example #3
0
 public void FinishTest()
 {
     var testStart = DateTime.UtcNow;
     Thread.Sleep(1);
     var target = new Trace_Accessor();
     Assert.IsTrue(target.Start.IsAfter(testStart));
     Thread.Sleep(10);
     target.Finish();
     Assert.IsTrue(target.End.IsAfter(target.Start));
 }