public void ToVertex_Should_Not_Throw_When_The_Properties_Is_Not_Present() { var vertex = GraphNodeGraphSON1Tests.GetGraphNode( "{" + "\"id\":{\"member_id\":0,\"community_id\":586910,\"~label\":\"vertex\",\"group_id\":2}," + "\"label\":\"vertex1\"," + "\"type\":\"vertex\"" + "}").ToVertex(); Assert.AreEqual("vertex1", vertex.Label); Assert.NotNull(vertex.Id); }
public void ToVertex_Should_Throw_When_Required_Attributes_Are_Not_Present() { Assert.Throws <InvalidOperationException>(() => GraphNodeGraphSON1Tests.GetGraphNode( "{" + "\"label\":\"vertex1\"," + "\"type\":\"vertex\"" + "}").ToVertex()); Assert.Throws <InvalidOperationException>(() => GraphNodeGraphSON1Tests.GetGraphNode( "{" + "\"id\":{\"member_id\":0,\"community_id\":586910,\"~label\":\"vertex\",\"group_id\":2}," + "\"type\":\"vertex\"" + "}").ToVertex()); }
public void ToEdge_Should_Not_Throw_When_The_Properties_Is_Not_Present() { var edge = GraphNodeGraphSON1Tests.GetGraphNode("{" + "\"id\":{" + "\"out_vertex\":{\"member_id\":0,\"community_id\":680148,\"~label\":\"vertex\",\"group_id\":3}," + "\"local_id\":\"4e78f871-c5c8-11e5-a449-130aecf8e504\",\"in_vertex\":{\"member_id\":0,\"community_id\":680148,\"~label\":\"vertex\",\"group_id\":5},\"~type\":\"knows\"}," + "\"label\":\"knows\"," + "\"type\":\"edge\"," + "\"inVLabel\":\"in-vertex\"" + "}").ToEdge(); Assert.AreEqual("knows", edge.Label); Assert.AreEqual("in-vertex", edge.InVLabel); Assert.Null(edge.OutVLabel); }
public void ToEdge_Should_Throw_When_Required_Attributes_Are_Not_Present() { Assert.Throws <InvalidOperationException>(() => GraphNodeGraphSON1Tests.GetGraphNode( "{" + "\"label\":\"knows\"," + "\"type\":\"edge\"," + "\"inVLabel\":\"in-vertex\"" + "}").ToEdge()); Assert.Throws <InvalidOperationException>(() => GraphNodeGraphSON1Tests.GetGraphNode( "{" + "\"id\":{" + "\"out_vertex\":{\"member_id\":0,\"community_id\":680148,\"~label\":\"vertex\",\"group_id\":3}," + "\"local_id\":\"4e78f871-c5c8-11e5-a449-130aecf8e504\",\"in_vertex\":{\"member_id\":0,\"community_id\":680148,\"~label\":\"vertex\",\"group_id\":5},\"~type\":\"knows\"}," + "\"type\":\"edge\"," + "\"inVLabel\":\"in-vertex\"" + "}").ToEdge()); }