public void FolderTest() { Cache cache = new Cache(); Folder folder = new Folder(null, "folder") { opaque_ref = "1" }; cache.AddFolder(new XenRef <Folder>(folder.opaque_ref), folder); Assert.IsTrue(cache.Folders.Length == 1); Assert.AreEqual(folder, cache.Resolve(new XenRef <Folder>(folder.opaque_ref))); Assert.AreEqual(folder, cache.Folders[0]); //Check tryresolve cache.TryResolve(new XenRef <Folder>(folder.opaque_ref), out var result); Assert.AreEqual(folder, result); //Check Clear cache.Clear(); Assert.IsTrue(cache.Folders.Length == 0); }
public void FolderTest() { Cache cache = new Cache(); Folder folder = new Folder(null, "folder") {opaque_ref = "1"}; cache.AddFolder(new XenRef<Folder>(folder.opaque_ref),folder); Assert.IsTrue(cache.Folders.Length==1); Assert.AreEqual(folder,cache.Resolve(new XenRef<Folder>(folder.opaque_ref))); Assert.AreEqual(folder,cache.Folders[0]); //Check tryresolve Folder result; cache.TryResolve(new XenRef<Folder>(folder.opaque_ref), out result); Assert.AreEqual(folder,result ); //Check Clear cache.Clear(); Assert.IsTrue(cache.Folders.Length==0); }