I have slightly adapted the custom behavior code that can be found here: http://www.reflectionit.nl/blog/default.aspx?guid=d81a8cf8-0345-48ee-bbde-84c2e3f21a25 that controls a MediaElement.
I need to know how to go about testing this with Rhino Mocks e.g. how to instantiate a new ControlMediaElementAction in test code and then call the Invoke method etc.
Doing something simple like this in test code: mMediaElementControlBehaviour = new ControlMediaElementAction (); gives me an exception "The type initializer for 'System.Windows.DependencyObject' throw an exception.
Thinking it was the instantiation of the MediaElement, I tried this two lines of code: MediaElement mediaElementStub = MockRepository.GenerateStub(); this.Container.RegisterInstance(mediaElementStub); This gave the exception 'Can't create mocks of sealed classes'
If someone can point me in the right direction, it would be apreciated.
Silverlight 4, Rhino Mocks 3.5 Silverlight v2.0.50727
Thanks,