Hi,

I think for your test it wouldn't make sense to use a mocked 
RoutedEventArgs object at all - why couldn't you just use a real 
RoutedEventArgs object?

Br,

Andreas

Am Dienstag, 16. September 2014 17:45:36 UTC+2 schrieb Vamsi Nudurupati:
>
> Hi,
>
> I am trying to Mock the OriginalSource in the RoutedEventArgs using Rhino 
> Mocks. Can any one please suggest on how to make this test pass as the 
> OriginalSource is null so the test fails as its not able to Convert the 
> EventArgs to ViewModel?
>
> [Test]
>         public void Covert_ShouldReturnViewModel_WhenArgsIsPassed()
>         {
>             
>             var routedEventArgs = 
> MockRepository.GenerateStub<RoutedEventArgs>();
>     var mockOriginalSource = routedEventArgs.Expect(eArgs => 
> eArgs.OriginalSource).Return("test mock");
>
>             var ViewModel = MockRepository.GenerateStub<ViewModel>();
>             
>             var eventArgsConverterHelper = 
> MockRepository.GenerateMock<EventArgsConverterHelper>();
>             eventArgsConverterHelper.Stub(
>                 eArgs => 
> eArgs.GetCallReasonViewModelMethod(mockOriginalSource))
>                 .Return(callReasonViewModel)
>                 .Repeat.Once();
>
>             var dTEventArgs = new EventArgsConverter();
>
>             Assert.That(dTEventArgs.Convert(routedEventArgs), 
> Is.EqualTo(ViewModel));
>         }
>
> thanks,
> Vamsi
>

-- 
You received this message because you are subscribed to the Google Groups 
"Rhino.Mocks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rhinomocks.
For more options, visit https://groups.google.com/d/optout.

Reply via email to