コード例 #1
0
        public void TestSelectOrRemoveDirectoryForMultipleSelection()
        {
            string myDocuments = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            string myPictures  = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
            string myMusic     = Environment.GetFolderPath(Environment.SpecialFolder.MyMusic);

            FileSystemController fileSystemController = new FileSystemController();

            Assert.False(fileSystemController.SelectedDirectories.Any());

            fileSystemController.SelectOrRemoveDirectoryForMultipleSelection(myDocuments);
            fileSystemController.SelectOrRemoveDirectoryForMultipleSelection(myPictures);
            fileSystemController.SelectOrRemoveDirectoryForMultipleSelection(myMusic);

            Assert.Contains(fileSystemController.SelectedDirectories, directory => directory.FullName == myDocuments);
            Assert.Contains(fileSystemController.SelectedDirectories, directory => directory.FullName == myPictures);
            Assert.Contains(fileSystemController.SelectedDirectories, directory => directory.FullName == myMusic);

            fileSystemController.SelectOrRemoveDirectoryForMultipleSelection(myMusic);

            Assert.Contains(fileSystemController.SelectedDirectories, directory => directory.FullName == myDocuments);
            Assert.Contains(fileSystemController.SelectedDirectories, directory => directory.FullName == myPictures);
            Assert.DoesNotContain(fileSystemController.SelectedDirectories, directory => directory.FullName == myMusic);
        }