void RemovePathUsingTileObject(object sender, EventArgs e) { try { var tile = (DiskTile)sender; var dr = MessageBox.Show($@"Are you sure you would like to remove ""{tile.Path}""?", @"Remove Path", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); Debug.Print(tile.Path); if (dr != DialogResult.Yes) { return; } _core.RemovePathFromList(tile.Path); tile.Visible = false; SaveChanges(); RebuildUserInterface(); } catch (Exception ex) { Debug.Print(ex.Message); } }
public void CreateAndAddPath() { var list = new DiskUsage(saveToDisk: false); Assert.AreEqual(0, list.Paths.Count); list.AddPathToList("C:\\", "C"); Assert.AreEqual(1, list.Paths.Count); //dont add duplicates list.AddPathToList("C:\\", "C"); Assert.AreEqual(1, list.Paths.Count); //now remove list.RemovePathFromList("C:\\"); Assert.AreEqual(0, list.Paths.Count); }