public void ExitCode(String message, NpmResultData expectedResult) { var span = Utils.CreateSpan(message); var parser = new NpmResultParser(); NpmResultData actualResult; var parsed = parser.TryParse(span, out actualResult); parsed.Should().BeTrue(); actualResult.ShouldBeEquivalentTo(expectedResult); }
public void NotParsed(String message) { var span = Utils.CreateSpan(message); var parser = new NpmResultParser(); NpmResultData actualResult; var parsed = parser.TryParse(span, out actualResult); parsed.Should().BeFalse(); actualResult.Should().BeNull(); }
public void NegativeExitCode() { const String messageString = "====npm command completed with exit code -8====\r\n"; var span = Utils.CreateSpan(messageString); var parser = new NpmResultParser(); NpmResultData data; var parsed = parser.TryParse(span, out data); Assert.IsTrue(parsed); Assert.IsNotNull(data); Assert.IsTrue(data.ExitCode.HasValue); Assert.AreEqual(-8, data.ExitCode); Assert.AreEqual(new Span(41, 2), data.ExitCode.Span); }
public void NotParsed() { const String messageString = "Some message\r\n"; const String messageString2 = "====npm command completed with exit code asdf====\r\n"; var span = Utils.CreateSpan(messageString); var parser = new NpmResultParser(); NpmResultData data; var parsed = parser.TryParse(span, out data); Assert.IsFalse(parsed); Assert.IsNull(data); span = Utils.CreateSpan(messageString2); parser = new NpmResultParser(); parsed = parser.TryParse(span, out data); Assert.IsFalse(parsed); Assert.IsNull(data); }