public unsafe void Simple_edge_read_write_without_data_should_work() { using (var storage = new GraphStorage()) { long vertexId1, vertexId2, edgeId; using (var tx = storage.WriteTransaction()) { vertexId1 = storage.AddVertex(tx, new byte[] { 1, 2, 3 }); vertexId2 = storage.AddVertex(tx, new byte[] { 3, 2, 1 }); edgeId = storage.AddEdge(tx, vertexId1, vertexId2); tx.Commit(); } using (var tx = storage.ReadTransaction()) { Assert.Empty(storage.ReadEdgeData(tx, edgeId)); int size; var data = storage.ReadEdgeData(tx, edgeId, out size); Assert.Equal(0, size); //will return valid ptr, but the size of data chunk is zero Assert.False(null == data); } } }
public void Simple_edge_delete_should_work() { using (var storage = new GraphStorage()) { long vertexId1, vertexId2, edgeId; using (var tx = storage.WriteTransaction()) { vertexId1 = storage.AddVertex(tx, new byte[] { 1, 2, 3 }); vertexId2 = storage.AddVertex(tx, new byte[] { 3, 2, 1 }); edgeId = storage.AddEdge(tx, vertexId1, vertexId2, new byte[] { 5, 6, 7, 8 }); tx.Commit(); } using (var tx = storage.ReadTransaction()) { var data = storage.ReadEdgeData(tx, edgeId); Assert.NotNull(data); } using (var tx = storage.WriteTransaction()) { storage.RemoveEdge(tx, edgeId); tx.Commit(); } using (var tx = storage.ReadTransaction()) { var data = storage.ReadEdgeData(tx, edgeId); Assert.Null(data); } } }