Skip to content

Commit

Permalink
Fix for picklesdoc#85 : NullReferenceError when feature was not run
Browse files Browse the repository at this point in the history
  • Loading branch information
freeman committed Dec 19, 2013
1 parent b020b65 commit 4284056
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Pickles/Pickles.Test/WhenParsingNUnitResultsFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,5 +158,15 @@ public void ThenCanReadNotFoundScenarioCorrectly()
result.WasExecuted.ShouldBeFalse();
result.WasSuccessful.ShouldBeFalse();
}

[Test]
public void ThenCanReadNotFoundFeatureCorrectly()
{
var results = ParseResultsFile();
var feature = new Feature {Name = "NotInTheFile"};
var result = results.GetFeatureResult(feature);
result.WasExecuted.ShouldBeFalse();
result.WasSuccessful.ShouldBeFalse();
}
}
}
4 changes: 4 additions & 0 deletions src/Pickles/Pickles/TestFrameworks/NUnitResults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ public TestResult GetFeatureResult(Feature feature)
{
var featureElement = this.GetFeatureElement(feature);

if (featureElement == null)
{
return TestResult.Inconclusive;
}
var results = featureElement.Descendants("test-case")
.Select(GetResultFromElement);

Expand Down

0 comments on commit 4284056

Please sign in to comment.