Right, I'm testing Rhino Mocks, and it's not working as I expected.
When I call the method, it returns null, not a List of one item, and
so the test fails with an NRE when I access the Count property.  I'm
just trying to figure out how to use Rhino properly to get this to
work as expected.

On Jul 2, 11:24 am, Patrick Steele <[email protected]> wrote:
> 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 Steelehttp://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 
> > athttp://groups.google.com/group/rhinomocks?hl=en.- Hide quoted text -
>
> - Show quoted text -

-- 
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.

Reply via email to