public void Error() { const String messageString = "VSOutputEnhancerDemo.vshost.exe Information: 10 : Trace information message\r\n"; var span = Utils.CreateSpan(messageString); var parser = new DebugTraceMessageParser(); DebugTraceMessageData data; var parsed = parser.TryParse(span, out data); Assert.IsTrue(parsed); Assert.IsNotNull(data); Assert.IsTrue(data.Source.HasValue); Assert.IsTrue(data.Type.HasValue); Assert.IsTrue(data.Id.HasValue); Assert.IsTrue(data.Message.HasValue); Assert.IsTrue(data.PrettyMessage.HasValue); Assert.AreEqual("VSOutputEnhancerDemo.vshost.exe", data.Source); Assert.AreEqual(TraceEventType.Information, data.Type); Assert.AreEqual(10, data.Id); Assert.AreEqual("Trace information message", data.Message); Assert.AreEqual("Information: 10 : Trace information message", data.PrettyMessage); Assert.AreEqual(new Span(0, 31), data.Source.Span); Assert.AreEqual(new Span(32, 11), data.Type.Span); Assert.AreEqual(new Span(45, 2), data.Id.Span); Assert.AreEqual(new Span(50, 25), data.Message.Span); Assert.AreEqual(new Span(32, 43), data.PrettyMessage.Span); }
public void NotParsed() { const String messageString = "Some message\r\n"; var span = Utils.CreateSpan(messageString); var parser = new DebugTraceMessageParser(); DebugTraceMessageData data; var parsed = parser.TryParse(span, out data); Assert.IsFalse(parsed); Assert.IsNull(data); }
public void NotParsed() { const String messageString = "Some message\r\n"; var span = Utils.CreateSpan(messageString); var parser = new DebugTraceMessageParser(); DebugTraceMessageData actualResult; var parsed = parser.TryParse(span, out actualResult); parsed.Should().BeFalse(); actualResult.Should().BeNull(); }
public void Error() { const String messageString = "VSOutputEnhancerDemo.vshost.exe Information: 10 : Trace information message\r\n"; var expectedResult = new DebugTraceMessageData( new ParsedValue <String>("VSOutputEnhancerDemo.vshost.exe", new Span(0, 31)), new ParsedValue <TraceEventType>(TraceEventType.Information, new Span(32, 11)), new ParsedValue <Int32>(10, new Span(45, 2)), new ParsedValue <String>("Trace information message", new Span(50, 25)), new ParsedValue <String>("Information: 10 : Trace information message", new Span(32, 43)) ); var span = Utils.CreateSpan(messageString); var parser = new DebugTraceMessageParser(); DebugTraceMessageData actualResult; var parsed = parser.TryParse(span, out actualResult); parsed.Should().BeTrue(); actualResult.ShouldBeEquivalentTo(expectedResult); }