public void Load_WithAvailableSources_DoesntSaveThoseSources()
        {
            Source rootFolder = new Source { IsRoot = true, SourceType = SourceType.Music, Folder = @"C:\Folder" };
            Source specificFolder = new Source { IsRoot = false, SourceType = SourceType.Music, Folder = @"C:\Folder\Music" };
            IEnumerable<Source> sources = new List<Source> { rootFolder, specificFolder };

            _sourceService.GetSources(SourceType.Music)
                .Returns(sources);

            // Act
            _viewModel.Load();

            // Assert
            _sourceService.DidNotReceiveWithAnyArgs()
                .Add(null);
        }
        public void Load_WithAvailableSources_AddsRootFoldersAndSpecificFolders()
        {
            // Arrange
            Source rootFolder = new Source { IsRoot = true, SourceType = SourceType.Music, Folder = @"C:\Folder" };
            Source specificFolder = new Source { IsRoot = false, SourceType = SourceType.Music, Folder = @"C:\Folder\Music" };
            IEnumerable<Source> sources = new List<Source> { rootFolder, specificFolder };

            _sourceService.GetSources(SourceType.Music)
                .Returns(sources);

            // Act
            _viewModel.Load();

            // Assert
            Assert.Equal(1, _viewModel.RootFolders.Count);
            Assert.Equal(rootFolder.Folder, _viewModel.RootFolders[0]);

            Assert.Equal(1, _viewModel.SpecificFolders.Count);
            Assert.Equal(specificFolder.Folder, _viewModel.SpecificFolders[0]);
        }
 /// <summary>
 /// Removes the specified source.
 /// </summary>
 /// <param name="source">The source.</param>
 public void Remove(Source source)
 {
     List<Source> sourcesList = GetSourceListForSourceType(source.SourceType);
     sourcesList.Remove(source);
 }
 /// <summary>
 /// Adds the specified source.
 /// </summary>
 /// <param name="source">The source.</param>
 public void Add(Source source)
 {
     List<Source> sourcesList = GetSourceListForSourceType(source.SourceType);
     sourcesList.Add(source);
 }
 private void RemoveFolders(IEnumerable<string> foldersToRemove, bool isRoot)
 {
     foreach (string folder in foldersToRemove)
     {
         Source source = new Source(_sourceType, isRoot, folder);
         _sourceService.Remove(source);
     }
 }
 private void AddFolders(IEnumerable<string> newFolders, bool isRoot)
 {
     foreach (string folder in newFolders)
     {
         Source source = new Source(_sourceType, isRoot, folder);
         _sourceService.Add(source);
     }
 }