/// <summary> /// Delete ther file and map file. /// </summary> /// <param name="collection">The collection that the node belongs to.</param> /// <param name="node">The node that represents the file.</param> /// <param name="path">The full path to the file.</param> public static void DeleteFile(Collection collection, BaseFileNode node, string path) { if (File.Exists(path)) { File.Delete(path); } try { // Now delete the map file. HashMap.Delete(collection, node); } catch {} }
public void Add() { HashMap <string> hashMap = new HashMap <string>(); hashMap.Add("bla", "Hello World!"); hashMap.Add("test", "This is a test"); hashMap.Add("newkey", "Some secret key"); hashMap.Add("fun", "It was fun"); Assert.Equal("Hello World!", hashMap.Get("bla")); Assert.Equal("This is a test", hashMap.Get("test")); Assert.Equal("Some secret key", hashMap.Get("newkey")); Assert.Equal("It was fun", hashMap.Get("fun")); Assert.Null(hashMap.Get("null")); Assert.Equal(4, hashMap.Count); hashMap.Delete("fun"); Assert.Null(hashMap.Get("fun")); Assert.Equal(3, hashMap.Count); }