Thanks. That worked great!

On May 13, 9:03 am, Changhong Fu <[email protected]> wrote:
> I figured out why the 1st one in my previous message didn't work. I had
> wrong closing bracket.
>
> It should be:
>
> myMockTextService.AssertWasCalled(s => s.SendMessage(
>
> Arg<IList<MyDto>>.Matches(List.Count(Rhino.Mocks.Constraints.Is.Equal(1)) &&
> List.Element(0, Property.Value("PhoneNumber", "07981000611")))));
>
>
>
>
>
> On Thu, May 13, 2010 at 5:59 PM, Changhong Fu <[email protected]> wrote:
> > Seems you really want to do is:
>
> > myMockTextService.AssertWasCalled(s => s.SendMessage(
>
> > Arg<IList<MyDto>>.Matches(List.Count(Is.Equal(1) && List.Element(0,
> > Property.Value("PhoneNumber", "07981000611"))))));
>
> > However, it doesn't work too and I don't know the reason. I need to dig
> > into the RihnoMock code to find why.
>
> > But, you can use following:
>
> > myMockTextService.AssertWasCalled(s => s.SendMessage(
>
> > Arg<IList<MyDto>>.Matches(l => l.Count == 1 && l[0].PhoneNumber ==
> > "07981000611")));
>
> > I prefer above code as it is simpler and there is no magic string
> > "PhoneNumber".
>
> > On Thu, May 13, 2010 at 1:52 AM, Jamie <[email protected]> wrote:
>
> >> I have a component which I'm mocking and I want to assert that it's
> >> SendMessages() method is called, passing in a IList<ITextDTO> of size
> >> 1 and the element at index 0 has a value of "07981000611" for it's
> >> PhoneNumber property.
>
> >> Here is the code in question:
>
> >> myMockTextService.Expect(
> >>                t => t.SendMessages(Arg<IList<ITextDTO>>.List
> >>                    .Count(Is.Equal(1) &&
> >>                    List.Element(0, Property.Value("PhoneNumber",
> >> "07981000611")))));
>
> >> With just the List.Count constraint, it works fine. Also, while
> >> debugging I can see the value is what I think it should be, so it must
> >> be my expectation syntax that is incorrect.
>
> >> What am I doing wrong?
>
> >> --
> >> 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]<rhinomocks%2bunsubscr...@googlegrou
> >>  ps.com>
> >> .
> >> 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 
> athttp://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.

Reply via email to