I have a fairly complex integration test that requires a lot of data in each distinct test case.
My test case class is as follows:
public class TestCases
{
public static IEnumerable MatchingCases
{
get
{
yield return
new SearchSetup
{
MinimumMatches = 1,
BulletinSetups = new List<BulletinSetup>
{
new BulletinSetup
{
ParameterSetups = new List<ParameterSetup>
{
new ParameterSetup
{
FieldName = "Number",
ParameterName = "@Number",
Value = "TBS1001" + DateTime.Now.ToLocalTime()
}
}
}
},
FilterValues = new Dictionary<string, object> { { "Number", "TBS1001" } }
};
}
}
}
The header of my test method is:
[Test, TestCaseSource(typeof(TestCases), "MatchingCases")]
public void Search_VariableFilter_NoAccountTeam_ResultIncludesExpected(SearchSetup searchSetup)
When I run the test, it returns inconclusive. When I step thru the code, I find that the MatchingCases property getter is being accessed, and the yield return statement executes w/o issue, but the test method itself is not called - or rather, not predictably.
See, I wrote this question up once already, then I tried moving the test class out of the testfixture scope. When I did that, the code executed once, and so I dumped my question. Then it stopped executing anymore...
Why isn't my test method being called?
Edit: Anticipating the question - these are the supporting classes being used:
public class ParameterSetup
{
public string ParameterName { get; set; }
public string FieldName { get; set; }
public object Value { get; set; }
}
public class BulletinSetup
{
public List<ParameterSetup> ParameterSetups { get; set; }
}
public class SearchSetup
{
public List<BulletinSetup> BulletinSetups { get; set; }
public int MinimumMatches { get; set; }
public Dictionary<string, object> FilterValues { get; set; }
}
Update - next day
After closing and reloading Visual Studio, and rerunning the test with no changes of any kind, the test code executes, repeatedly. I'm beginning to suspect this was a transitory glitch.
Since reloading VS the test method executes fine. I'm chalking it up as a glitch to close this question out.