public AddFolder ( string path, System.DateTime serverSideModificationDate ) : void | ||
path | string | |
serverSideModificationDate | System.DateTime | |
return | 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 TestMoveFolder() { using (Database database = new Database(DatabasePath)) { Directory.CreateDirectory(Path.Combine(RootPath, "folder1/folder2")); string oldPath = Path.Combine(RootPath, "folder1/folder2", "1.test"); CreateTestFile(oldPath, 10); string newPath = Path.Combine(RootPath, "sub1/folder2", "1.test"); database.AddFile(oldPath, "1", DateTime.Now, null, FakeHash); database.AddFolder(Path.Combine(RootPath, "folder1"), "D1", DateTime.Now); database.AddFolder(Path.Combine(RootPath, "folder1/folder2"), "D12", DateTime.Now); Assert.True(database.ContainsFile(oldPath)); Assert.True(database.ContainsFolder(Path.Combine(RootPath, "folder1"))); Assert.True(database.ContainsFolder(Path.Combine(RootPath, "folder1/folder2"))); Assert.False(database.ContainsFile(newPath)); Assert.False(database.ContainsFolder(Path.Combine(RootPath, "sub1"))); Assert.False(database.ContainsFolder(Path.Combine(RootPath, "sub1/folder2"))); database.MoveFolder(Path.Combine(RootPath, "folder1"), Path.Combine(RootPath, "sub1")); Assert.False(database.ContainsFile(oldPath)); Assert.False(database.ContainsFolder(Path.Combine(RootPath, "folder1"))); Assert.False(database.ContainsFolder(Path.Combine(RootPath, "folder1/folder2"))); Assert.True(database.ContainsFile(newPath)); Assert.True(database.ContainsFolder(Path.Combine(RootPath, "sub1"))); Assert.True(database.ContainsFolder(Path.Combine(RootPath, "sub1/folder2"))); } }