public void CanAddAndRemove() { var sourceNode = new Node(Utils.Id("foo")); var simpleMap = new SimpleMap <NodeID, NodeID>(); simpleMap.Init(sourceNode, db); for (int i = 0; i < 100; i++) { simpleMap.Add(Utils.Id($"foo/{i}"), Utils.Id("bar")); } for (int i = 0; i < 100; i += 2) { simpleMap.Remove(Utils.Id($"foo/{i}")); } for (int i = 0; i < 100; i++) { if (i % 2 == 1) { Assert.Contains(Utils.Id($"foo/{i}"), simpleMap); } else { Assert.DoesNotContain(Utils.Id($"foo/{i}"), simpleMap); } } }
public void CantInitEmpty() { var sourceNode = new Node(Utils.Id("foo")); var simpleList = new SimpleMap <NodeID, NodeID>(); simpleList.Init(sourceNode, db); }
public void CanAddAndClear() { var sourceNode = new Node(Utils.Id("foo")); var simpleMap = new SimpleMap <NodeID, NodeID>(); simpleMap.Init(sourceNode, db); for (int i = 0; i < 100; i++) { simpleMap.Add(Utils.Id($"foo/{i}"), Utils.Id("bar")); } simpleMap.Clear(); Assert.Empty(simpleMap); }
public void CantInit() { var sourceNode = new Node { Id = Utils.Id("simpleMap1"), Attributes = new Map { Items = new List <KeyValue>() } }; var simpleList = new SimpleMap <NodeID, NodeID>(); simpleList.Init(sourceNode, db); }
public void CanAddAndIterate() { var sourceNode = new Node(Utils.Id("foo")); var simpleMap = new SimpleMap <NodeID, NodeID>(); simpleMap.Init(sourceNode, db); for (int i = 0; i < 100; i++) { simpleMap.Add(Utils.Id($"foo/{i}"), Utils.Id("bar")); } for (int i = 0; i < 100; i++) { simpleMap.Contains(new KeyValuePair <NodeID, NodeID>(Utils.Id($"foo/{i}"), Utils.Id("bar"))); Assert.Contains(Utils.Id($"foo/{i}"), simpleMap.Keys); } }