If I run this test method in a Silverlight test the Assertion fails:
DelegateCommand.Execute(anything); Expected #1, Actual #0.
[TestMethod]
[Asynchronous]
public void TestMethod()
{
ViewModel vm = new ViewModel();
DelegateCommand addCommand =
MockRepository.GenerateStub<DelegateCommand>((Action)vm.Add,
(Func<bool>)vm.CanAdd);
addCommand.Stub(x => x.CanExecute(null)).Return(true);
vm.AddCommand = addCommand;
TestPage target = new TestPage(vm);
WaitFor(target, "Loaded");
this.TestPanel.Children.Add(target);
ButtonAutomationPeer buttonPeer = new
ButtonAutomationPeer(target.uxAdd);
IInvokeProvider buttonInvoker = (IInvokeProvider)buttonPeer;
EnqueueCallback(() => buttonInvoker.Invoke());
// If I uncomment thhis line the test passes...?
// EnqueueCallback(() => addCommand.AssertWasCalled(x =>
x.CanExecute(Arg<object>.Is.Anything)));
EnqueueCallback(() => addCommand.AssertWasCalled(x =>
x.Execute(Arg<object>.Is.Anything)));
EnqueueTestComplete();
}
However if I uncomment the marked line, both Assertions pass and therefore
so does the test.
Can anyone suggest why this is happening?
Thanks
Mark
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---