public void Rename_NormalFile() { var mockFileSystem = CreateMockFileSystem(); var mockFile = new MockFileInfo(mockFileSystem, filePathA); const string renamedFileName = "newFileName.txt"; string renamedFilePath = Path.Combine(targetDirPath, renamedFileName); mockFile.Rename(renamedFilePath); mockFile.Refresh(); mockFile.FullName .Should().Be(renamedFilePath); mockFile.Name .Should().Be(renamedFileName); mockFileSystem.AllPaths .Should().NotContain(filePathA); mockFileSystem.AllPaths .Should().Contain(renamedFilePath); }
public void Rename_File_OnlyCase() { var mockFileSystem = CreateMockFileSystem(); var mockFile = new MockFileInfo(mockFileSystem, filePathA); const string renamedFileName = "a.txt"; string renamedFilePath = Path.Combine(targetDirPath, renamedFileName); mockFile.Rename(renamedFilePath); mockFile.Refresh(); mockFile.FullName .Should().Be(renamedFilePath); mockFile.Name .Should().Be(renamedFileName); //MockFileSystemのバグ?変更されない //mockFileSystem.AllPaths // .Should().NotContain(filePathA); //mockFileSystem.AllPaths // .Should().Contain(renamedFilePath); }
public void Refresh() { _fileInfo.Refresh(); }