Closed karlingen closed 6 years ago
It.Is
(which is what is automatically used if you just pass in arguments directly, like "EditPage"
and parameters
in your code) uses object.Equals
so overriding Equals
in your NavigationParameters
may be one option if it's under your control. You could also use It.Matches
instead.
I love it, thanks! ❤️
var parameters = new NavigationParameters();
parameters.Add("id", item.Id);
navigationService
.Verify(x => x.NavigateAsync("EditPage", It.Matches<NavigationParameters>(y => y.ToString() == parameters.ToString())))
.WasCalledExactlyOnce();
I'm trying to verify that a navigation method on the
NavigationService
is called exactly once with the following code:However it yields the following exception:
I've added breakpoints and the NavigateAsync sure is being hit with the exact same parameters, so I assume it fails because it expects the
parameters
to be an exact object and not another instance of the same class.I would like to verify that a
NavigationParameters
is passed to theNavigateAsync
and that theNavigationParameters
should have aid
key with the value of theItem.Id
.Is this possible?