public void RenameBfsSubFolder() { //Arrange //add new sub folder with new bf's to be deleted RepositoryFolder <MyRepositoryItem> BFRF = mSolutionRepository.GetRepositoryItemRootFolder <MyRepositoryItem>(); RepositoryFolder <MyRepositoryItem> folderToRename = (RepositoryFolder <MyRepositoryItem>)BFRF.AddSubFolder("RenameBfsSubFolder_FolderToRename"); MyRepositoryItem bf1 = new MyRepositoryItem("FolderToRename_bf1"); folderToRename.AddRepositoryItem(bf1); MyRepositoryItem bf2 = new MyRepositoryItem("FolderToRename_bf2"); folderToRename.AddRepositoryItem(bf2); //add new sub-sub folder with new bf's under the folder which will be renamed RepositoryFolder <MyRepositoryItem> subfolderUnderRenamedFolder = (RepositoryFolder <MyRepositoryItem>)folderToRename.AddSubFolder("RenameBfsSubFolder_subfolderUnderRenamedFolder"); MyRepositoryItem bf3 = new MyRepositoryItem("FolderToRename_bf3"); subfolderUnderRenamedFolder.AddRepositoryItem(bf3); //Act string newName = "RenameBfsSubFolder_NewName"; folderToRename.RenameFolder(newName); ObservableList <MyRepositoryItem> bfs = mSolutionRepository.GetAllRepositoryItems <MyRepositoryItem>(); //Assert Assert.IsTrue(folderToRename.FolderRelativePath.Contains(newName), "Validate folder relative path was updated"); Assert.IsTrue(folderToRename.FolderFullPath.Contains(newName), "Validate folder full path was updated"); Assert.IsTrue(Directory.Exists(folderToRename.FolderFullPath), "Validate folder full path is valid"); Assert.AreEqual(folderToRename.DisplayName, newName, "Validate folder Display Name is correct"); Assert.AreEqual(folderToRename.FolderName, newName, "Validate Folder Name is correct"); Assert.IsTrue(subfolderUnderRenamedFolder.FolderRelativePath.Contains(newName), "Validate sub folder relative path was updated"); Assert.IsTrue(subfolderUnderRenamedFolder.FolderFullPath.Contains(newName), "Validate sub folder full path was updated"); Assert.IsTrue(Directory.Exists(subfolderUnderRenamedFolder.FolderFullPath), "Validate sub folder full path is valid"); Assert.IsTrue(bf1.ContainingFolder.Contains(newName), "Validate level 1 BF ContainingFolder was updated"); Assert.IsTrue(bf1.ContainingFolderFullPath.Contains(newName), "Validate level 1 BF ContainingFolderFullPath was updated"); Assert.IsTrue(bf1.FilePath.Contains(newName), "Validate level 1 BF FilePath was updated"); Assert.IsTrue(File.Exists(bf1.FilePath), "Validate level 1 BF FilePath is valid"); Assert.IsTrue(bf3.ContainingFolder.Contains(newName), "Validate level 2 BF ContainingFolder was updated"); Assert.IsTrue(bf3.ContainingFolderFullPath.Contains(newName), "Validate level 2 BF ContainingFolderFullPath was updated"); Assert.IsTrue(bf3.FilePath.Contains(newName), "Validate level 2 BF FilePath was updated"); Assert.IsTrue(File.Exists(bf3.FilePath), "Validate level 2 BF FilePath is valid"); Assert.AreEqual(bfs.Where(x => x.Guid == bf1.Guid).ToList().Count, 1, "Make sure level 1 item is not loaded to cache more than once"); Assert.AreEqual(bfs.Where(x => x.Guid == bf3.Guid).ToList().Count, 1, "Make sure level 2 item is not loaded to cache more than once"); }