Hello. I'm diving into ASP.NET MVC 2 and I'm walking through a tutorial and I'm getting an error related to a template method in my unit tests. The erroneous code is...
var displayedProducts = (IList<Product>)result.ViewData.Model;
displayedProducts.Count.ShouldEqual(2);
and the method definition for ShouldEqual
is...
public static void ShouldEqual<T>(this T actualValue, T expectedValue)
{
Assert.AreEqual(expectedValue, actualValue);
}
and the error is...
'int' does not contain a definition for 'ShouldEqual' and no extension method 'ShouldEqual' accepting a first argument of type 'int' could be found (are you missing a using directive or an assembly reference?)
but because I'm so new to all this, I don't see what I missing.
- Does anyone see the problem?
- Can someone explain to me how
ShouldEqual
is a member function ofCount
Thanks so much for your help! If more code is needed, please let me know.