Remove() public méthode

public Remove ( JToken key ) : void
key JToken
Résultat void
Exemple #1
0
		public void CanRemoveFromTree()
		{
			var buffer = new byte[1024];
			var tree = new Tree(new MemoryStream(buffer), new MemoryStream(buffer), StartMode.Create);
			tree.Add("ayende", 44);
			tree.Add("oren", 77);

			var doc = tree.FindValue("oren");
			Assert.Equal(77, doc);

			tree.Remove("ayende");

			Assert.Null(tree.FindValue("ayende"));
			doc = tree.FindValue("oren");
			Assert.Equal(77, doc);

		}
Exemple #2
0
		public void CanRemoveFromTreeAndReadFromAnother()
		{
			var buffer = new byte[1024];
			var tree = new Tree(new MemoryStream(buffer), new MemoryStream(buffer), StartMode.Create);
			tree.Add("ayende", 13);
			tree.Add("oren", 978);
			tree.Remove("ayende");
			tree.Flush();

			tree = new Tree(new MemoryStream(buffer)
			{
				Position = tree.RootPosition
			}, new MemoryStream(buffer), StartMode.Open);
			Assert.Null(tree.FindValue("ayende"));
			var doc = tree.FindValue("oren");
			Assert.Equal(978, doc);
		}
Exemple #3
0
 public void Remove(long id)
 {
     tree.Remove(new JObject(new JProperty("Id", new JValue(currentId))));
 }