Ejemplo n.º 1
0
        public void DeleteTest()
        {
            string path = "foo.txt";

            fileMock.Setup(f => f.Exists(path)).Returns(true);
            fileMock.Setup(f => f.Delete(path));
            fileOperator.Delete(path);
            fileMock.VerifyAll();

            path = "bar";
            directoryMock.Setup(d => d.Exists(path)).Returns(true);
            directoryMock.Setup(d => d.Delete(path, true));
            fileOperator.Delete(path, false);
            directoryMock.VerifyAll();
        }
        /// <summary>
        /// Removes the <see cref="SelectedUser"/> from the <see cref="AvailableUsers"/>
        /// and deleted its xml file.
        /// </summary>
        public void RemoveUser()
        {
            try
            {
                if (SelectedUser == ActiveUser)
                {
                    ActiveUser = null;
                }

                // remove xml file
                _fileOperator.Delete(Path.Combine(USERSFOLDER, SelectedUser.Username) + ".xml");
                AvailableUsers.Remove(SelectedUser);
            }
            catch (Exception ex)
            {
                _windowManager.MessageBoxService.ShowDialog("Could not remove user from list: " + ex.Message);
            }
        }
 public void Execute()
 {
     m_Receiver.Delete(m_FileName);
 }