public void Should_Search_Contacts_Execute()
        {
            //ARRANGE
            var contactsDataService = MockRepository.GenerateStub <IContactsDataService>();
            var stateManager        = MockRepository.GenerateStub <IVisualStateManager>();
            var dispatcher          = new MockDispatcherService();
            var mockContactData     = new List <Contact>
            {
                new Contact()
            };

            //ACT..
            var viewModel = new ContactListViewModel(contactsDataService, stateManager, dispatcher);

            viewModel.SearchCommand.Execute("some string");

            //we have to make our mock service actually pass back the mock data
            EnsureCallbackForIContactsDataServiceIsCalled(contactsDataService, s => s.GetContactsByName(null, null), mockContactData, args => args[1]);

            //ASSERT
            Assert.AreEqual(mockContactData.Count, viewModel.Contacts.Count, "The contacts were not populated");
            contactsDataService.AssertWasCalled(cds => cds.GetContacts(null), call => call.Constraints(new Anything()));
            stateManager.AssertWasCalled(sm => sm.GoToState("LoadingContacts"));
            stateManager.AssertWasCalled(sm => sm.GoToState("ContactsLoaded"));
        }
        public void Should_Search_Contacts_CanExecute()
        {
            //ARRANGE
            var contactsDataService = MockRepository.GenerateStub <IContactsDataService>();
            var stateManager        = MockRepository.GenerateStub <IVisualStateManager>();
            var dispatcher          = new MockDispatcherService();

            //ACT..
            var viewModel = new ContactListViewModel(contactsDataService, stateManager, dispatcher);

            //ASSERT
            Assert.IsTrue(viewModel.SearchCommand.CanExecute("some string"));
            Assert.IsFalse(viewModel.SearchCommand.CanExecute(null));
            Assert.IsFalse(viewModel.SearchCommand.CanExecute(""));
        }