public void CanDeleteKeyCommandTest() { var viewModel = new ManageLocalKeysViewModel(VaultName, new Mock <IKeyRepository>().Object); viewModel.SetSelectedKey(KeyWithIdentifier); Assert.IsTrue(viewModel.DeleteKeyCommand.CanExecute(null)); }
public void DeleteKeyCommandTest() { var keyRepository = new Mock <IKeyRepository>(); var key = KeyWithIdentifier; var viewModel = new ManageLocalKeysViewModel(VaultName, keyRepository.Object); viewModel.KeysModified += (sender, args) => Assert.IsInstanceOfType(sender, typeof(ManageLocalKeysViewModel)); viewModel.SetSelectedKey(key); viewModel.DeleteKeyCommand.Execute(null); keyRepository.Verify(a => a.Delete(key), Times.Once); }