public MoveFile ( string oldPath, string newPath ) : void | ||
oldPath | string | |
newPath | string | |
Результат | void |
public void TestSpecialCharacter() { string oldPath = Path.Combine(RootPath, "a'b'c"); string newPath = Path.Combine(RootPath, "'a'b'c'"); using (Database database = new Database(DatabasePath)) { CreateTestFile(oldPath, 10); database.AddFile(oldPath, "1", DateTime.Now, null, FakeHash); Assert.True(database.ContainsFile(oldPath)); Assert.False(database.ContainsFile(newPath)); database.MoveFile(oldPath, newPath); Assert.False(database.ContainsFile(oldPath)); Assert.True(database.ContainsFile(newPath)); database.RemoveFile(newPath); Assert.False(database.ContainsFile(oldPath)); Assert.False(database.ContainsFile(newPath)); } using (Database database = new Database(DatabasePath)) { database.AddFolder(oldPath, "1", DateTime.Now); Assert.True(database.ContainsFolder(oldPath)); Assert.False(database.ContainsFolder(newPath)); database.MoveFolder(oldPath, newPath); Assert.False(database.ContainsFolder(oldPath)); Assert.True(database.ContainsFolder(newPath)); database.RemoveFolder(newPath); Assert.False(database.ContainsFolder(oldPath)); Assert.False(database.ContainsFolder(newPath)); } }
public void TestMoveFile() { using (Database database = new Database(DatabasePath)) { string oldPath = Path.Combine(RootPath, "1.old"); CreateTestFile(oldPath, 10); string newPath = Path.Combine(RootPath, "1.new"); database.AddFile(oldPath, "1", DateTime.Now, null, FakeHash); Assert.True(database.ContainsFile(oldPath)); Assert.False(database.ContainsFile(newPath)); database.MoveFile(oldPath, newPath); Assert.False(database.ContainsFile(oldPath)); Assert.True(database.ContainsFile(newPath)); } }