Hi,
When I write my test in the following form:
Quote:
[Test]
[AutoMoqData]
public void When_GetAllResults_Then_ItShouldGetOnlyResults2(Fixture fixture, [Frozen] Mock<ICompetitionsService> competitionsServiceAsMock,
CompetitionsProvider sut)
{
IEnumerable<MatchModel> competitions = fixture.CreateMany<MatchModel>(4);
competitionsServiceAsMock
.Setup(x => x.GetResults(It.IsAny<string>(), It.IsAny<string>()))
.Returns(competitions.AsQueryable());
...
var result = sut.GetAll<MatchModel>(dataRequest);
int expected = 4;
result.Items.Count().ShouldBe(expected);
}
The test is not beeing able to run and I get the following message:
Quote:NCrunch was unable to locate this test during NUnit's execution run. This problem can be caused by tests with names that contain random elements, such as through the use of NUnit's RandomAttribute. Please ensure your test is named consistently or consider changing your 'Framework utilisation type for NUnit' solution-level configuration setting to 'StaticAnalysis'.
In Resharper this test runs normally and passes. Note that test written in other way, also passes in NCrunch, but of course, I want to use the above way, since it dramatically reduces the amount of code.
Quote:[Test]
public void When_GetAllResults_Then_ItShouldGetOnlyResults1()
{
var fixture = new Fixture();
fixture.Customize(new AutoMoqCustomization());
var competitionsServiceAsMock = fixture.Freeze<Mock<ICompetitionsService>>();
IEnumerable<MatchModel> competitions = fixture.CreateMany<MatchModel>(4);
competitionsServiceAsMock
.Setup(x => x.GetResults(It.IsAny<string>(), It.IsAny<string>()))
.Returns(competitions.AsQueryable());
...
var result = sut.GetAll<MatchModel>(dataRequest);
result.Items.Count().ShouldBe(4);
}
Will this be fixed (or is it already fixed) or is an advice that I have noticed here, not to use AutoMoqData, and have 10.000 lines of additional code? I was planning to buy it, but in this case of course, I have no use of it, since I am writing all of my test in this way.
Kind regards,
Sebastijan