Ejemplo n.º 1
0
        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);
        }
        void AddNewPath(object sender, EventArgs e)
        {
            var dialog = new AddPathDialog {
                InitialPath = Windows.InstallDirectory
            };
            var result = dialog.ShowDialog(this);

            if (result == DialogResult.OK)
            {
                var addPathOperation = _core.AddPathToList(dialog.NewComputer);

                if (!addPathOperation.Success)
                {
                    MessageBox.Show(addPathOperation.Message, @"Unable to add path");
                }
                RebuildUserInterface();
                SaveChanges();
            }
        }