I have a table with 2 columns.
| DealerCode | TransactionID |
| 222223 | 98766 |
and i have this method that returns a list
public List<Transaction> GetCurrentTransaction(string dealerCode, string transactionId)
{
return context.Transactions.Where(c => c.DealerCode == dealerCode && (c.TransactionID == transactionId)).ToList();
}
however everytime i tried to unit test it, it always display true, as you can see in my testing, i purposedly created a wrong parameter so that it would fail.
Assert.IsNotNull(tran.GetCurrentTransaction("2222231", "987661"));
i have tried searching thru the forums and googling to no avail.
Your method returns an instance of List, and even though it contains no items (since there are no records matching the criteria), the list itself is still created, and therefore, not equal to NULL, and thats the reason your unittest passes.