public async Task RenameFsTest_FakeIStorage_FileToNonExistFolder_Items() { CreateFoldersAndFilesInDatabase(); var initFolderList = new List <string> { "/" }; var initFileList = new List <string> { _fileInExist.FilePath }; var iStorage = new FakeIStorage(initFolderList, initFileList); var renameFs1 = await new RenameService(_query, iStorage) .Rename(initFileList.FirstOrDefault(), "/nonExist/test5.jpg", true); var renameFs = renameFs1.Where(p => p.Status != FileIndexItem.ExifStatus.Deleted).ToList(); var all2 = await _query.GetAllRecursiveAsync(); var selectFile3 = all2.FirstOrDefault(p => p.FileName == "test5.jpg"); Assert.AreEqual("test5.jpg", selectFile3.FileName); Assert.AreEqual("/nonExist", selectFile3.ParentDirectory); // check if files are moved var values = iStorage.GetAllFilesInDirectory("/nonExist").ToList(); Assert.AreEqual("/nonExist/test5.jpg", values.FirstOrDefault(p => p == "/nonExist/test5.jpg")); var initFileListFirst = renameFs.FirstOrDefault(p => p.FilePath == initFileList.FirstOrDefault()); Assert.AreEqual(initFileList.FirstOrDefault(), initFileListFirst.FilePath); Assert.AreEqual(FileIndexItem.ExifStatus.NotFoundSourceMissing, initFileListFirst.Status); var nonExistTest5 = renameFs.FirstOrDefault(p => p.FilePath == "/nonExist/test5.jpg"); Assert.AreEqual("/nonExist/test5.jpg", nonExistTest5.FilePath); Assert.AreEqual(FileIndexItem.ExifStatus.Ok, nonExistTest5.Status); var nonExist = renameFs.FirstOrDefault(p => p.FilePath == "/nonExist"); Assert.AreEqual("/nonExist", nonExist.FilePath); Assert.AreEqual(FileIndexItem.ExifStatus.Ok, nonExist.Status); RemoveFoldersAndFilesInDatabase(); }