I have a project using xUnit with lots of unit tests that were all passing when using Resharper to run the tests. Now I've just downloaded NCrunch (which I really like by the way) and it fails a lot of the tests. An example is shown below:
Code:
[Fact]
public void GetMarket_ShowMarketPickerPage()
{
var numberOfFlagsExpected = MockCollections.MockFlagCollection.Count;
var response = Browser.Get("/");
response.Body["div[class='flags slider__panel']"].ShouldExist();
response.Body["li[class^='flags__']"].ShouldExistExactly(numberOfFlagsExpected);
}
For this particular method the error is: Nancy.Testing.AssertException: Nancy.Testing.AssertException : The selector did not match any elements in the document.
Another example using [Theory]:
Code:
[Theory]
[InlineData("terms", "terms-popup")]
[InlineData("privacy", "privacy-popup")]
[InlineData("parentscorner", "parentscorner-popup")]
[InlineData("cookies", "cookies-popup")]
[InlineData("contact", "contact-popup")]
[InlineData("playsafe", "playsafe-popup")]
public void GetContent_GetPageForMarketAndLanguage(string contentName, string expectedArticleId)
{
LanguageService.GetLanguagesForMarket("ar")
.Returns(MockCollections.MockLanguageCollection.Where(x => x.Market == "ar"));
var contentRoute = string.Format("/ar/en/{0}", contentName);
var response = Browser.Get(contentRoute);
// Check the
var expectedArticleTag = string.Format(@"article[id=""{0}""]", expectedArticleId);
response.Body[expectedArticleTag].ShouldExistOnce();
}
And the error for this method is: Nancy.Testing.AssertException: Nancy.Testing.AssertException : The collection contained no values.
why am I getting these errors on NCrunch but not other test runners? Any explaination on this would be greatly appreciated, thanks