Basically i am not sure how can i write unit tests using Rhinomock
dll. So I want a sample to explain how i  can make write Unit Tests
using Rhinomock.

I have written a test method as below:

[TestMethod]
        public void TestForPage()
        {
            PersonView page = new PersonView();
            MockRepository mocks = new MockRepository();
            PersonViewModel pageViewModel = (PersonViewModel)
mocks.DynamicMock(typeof(PersonViewModel));
            page.DataContext = pageViewModel;
            ObservableCollection<Person> people = new
ObservableCollection<Person>
            {
                new Person(){ID = 1, Name="Raju", Age=10,
City="Bangalore", Country="India"},
                new Person(){ID = 2, Name="Zinedine Zidane", Age=20,
City="Marseille", Country="France"},
                new Person(){ID = 3, Name="Ronaldinho", Age=30,
City="Porto Alegre", Country="Brazil"},
                new Person(){ID = 4, Name="John Smith", Age=40,
City="Washington", Country="USA"}

            };
            using (mocks.Record())
            {
                pageViewModel.Expect(p => p.PersonList).Return
(people);            }
            mocks.VerifyAll();

}

It is throwing following exception:
TestForPage
Rhino.Mocks.Exceptions.ExpectationViolationException occurred
PersonViewModel.get_PersonList(); Expected #1, Actual #0.
PersonViewModel.get_NewPerson(); Expected #1, Actual #0.
PersonViewModel.get_PersonList(); Expected #1, Actual #0.

Please help.


On Jul 12, 4:29 am, Ayende Rahien <[email protected]> wrote:
> what was the problem?
>
>
>
> On Fri, Jul 10, 2009 at 4:27 PM, DV <[email protected]> wrote:
>
> > I have a silverlight app implemeneted using MVVM pattern. Do you have
> > any sample to use Rhinomock for testing this?
>
> > I refered this
>
> >http://silverlight.net/blogs/justinangel/archive/2009/02/25/silverlig...
>
> > But i did not get it worked for my app.
>
> > Please help.
>
> > Thanks in advance
> > Devika- 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