public async Task ItemDeleteCommand_ViewRefreshed() { await _testViewModel.Init(); _localCurrencyService.ClearBehavior(); _localCurrencyService.Expect(x => x.DeleteRecordAsync("test2")).Return(Task.CompletedTask); _localCurrencyService.Stub(x => x.GetAllRecordsNamesAsync()).Return(Task.FromResult(new List <string> { "test1", "test3" })); await _testViewModel.Items[1].RemoveDataRecordCommand.ExecuteAsync(); Assert.AreEqual(2, _testViewModel.Items.Count); Assert.AreEqual("test3", _testViewModel.Items[1].DisplayName); _localCurrencyService.VerifyAllExpectations(); }
public void Setup() { SimpleIoc.Default.Reset(); Messenger.Reset(); _errorHandler = MockRepository.GenerateMock <IErrorHandler>(); _localCurrencyService = MockRepository.GenerateMock <ILocalCurrencyService>(); _localCurrencyService.Stub(x => x.GetAllRecordsNamesAsync()).Repeat.Any().Return(Task.FromResult(new List <string> { "test1", "test2", "test3" })); _navigator = MockRepository.GenerateMock <INavigator>(); SimpleIoc.Default.Register(() => _navigator); _testViewModel = new PickLocalDataViewModel(_localCurrencyService, _errorHandler); }