What exactly are you testing? You have a call to a method and you specifically define a return value as a List<Invoice> with one item. You then do an assert that the list only contains one item. All you're really testing here is Rhino.Mocks, not your class.
If you could explain a little more what exactly you want to test, we could probably help you out. Thanks. --- Patrick Steele http://weblogs.asp.net/psteele On Fri, Jul 2, 2010 at 11:51 AM, Adam <[email protected]> wrote: > Hi. InvoiceDAO is a public class, with a parameterless constructor. > Also, GetInvoicesByConstraint is declared as virtual. If I have the > following: > > InvoiceDAO dao = > MockRepository.GenerateMock<DataLayer.DAO.InvoiceDAO>(); > dao.Expect(d => > d.GetInvoicesByConstraint(Arg<InvoiceConstraints>.Is.Anything)).Return(new > List<Invoice>() { new Invoice() }); > > Assert.AreEqual(dao.GetInvoicesByConstraint(null).Count, 1); > > how would I go about getting this test to pass? The method returns > null as is, so I end up with a null reference exception. > > Thanks! > > -- > You received this message because you are subscribed to the Google Groups > "Rhino.Mocks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rhinomocks?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Rhino.Mocks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rhinomocks?hl=en.
