Hi, say I have a method I wish to test:
public Cars[] GetCars();
I want to test that the array returned by this method contains at least one car which is of type "Mustang".
How would I actually do this?
Currently I have code like:
[Test]
public void GetCars_ReturnsMustangs()
{
Cars[] cars = GetCars();
foreach(Car car in cars)
{
Assert.IsTrue(Car.Type == "Mustang");
}
}
While this works as a test as far as I can tell I'm aware it's not a good idea to put loops inside the test?
Can anybody suggest a better alternative?
Thanks!