public void Contains_Methods_has_to_work() { Vertex vertex1 = new Vertex("00"); HyperEdge test2 = new HyperEdge(vertex1, vertex1, vertex1); Assert.IsTrue(test2.ContainsOnVertexBasis(vertex1)); Assert.IsFalse(test2.ContainsOnEdgeBasis(vertex1)); }
public void HyperGraph_AddEdge_has_to_work() { HyperGraph hyperGraph = new HyperGraph(); Assert.ThrowsException <ArgumentException>(() => { hyperGraph.AddEdge("00", "00", "00"); }, "This graph does not conatin a vertex with value '00'."); Vertex v1 = hyperGraph.AddVertex("00"); HyperEdge h1 = hyperGraph.AddEdge("00", "00", "00"); Assert.AreEqual(3, h1.VertexCount()); Assert.IsTrue(h1.ContainsOnVertexBasis(v1)); HyperEdge h2 = new HyperEdge("00", "01", "10"); Assert.ThrowsException <ArgumentException>(() => { hyperGraph.AddEdge(new Vertex("00"), new Vertex("01"), new Vertex("10")); }, $"This graph does not conatin a vertex with value '01'"); Vertex v2 = hyperGraph.AddVertex("11"); Vertex v3 = hyperGraph.AddVertex("01"); Vertex v4 = hyperGraph.AddVertex("10"); Assert.ThrowsException <ArgumentException>(() => hyperGraph.AddEdge(v2, v2, v2), "Vertices must not be equal."); HyperEdge h3 = hyperGraph.AddEdge(v1, v3, v4); Assert.IsTrue(h3.ContainsOnVertexBasis(v1)); Assert.IsTrue(h3.ContainsOnVertexBasis(v3)); Assert.IsTrue(h3.ContainsOnVertexBasis(v4)); Assert.IsFalse(h3.ContainsOnEdgeBasis(v1)); Assert.IsFalse(h3.ContainsOnEdgeBasis(v3)); Assert.IsFalse(h3.ContainsOnEdgeBasis(v4)); HyperEdge h4 = new HyperEdge(new Vertex("00"), new Vertex("01"), new Vertex("10")); Assert.IsTrue(hyperGraph.HasEdge(h4)); Assert.ThrowsException <ArgumentException>(() => { hyperGraph.AddEdge(new Vertex("00"), new Vertex("01"), new Vertex("10")); }, $"This Graph has already an edge '-00-01-10->'."); Assert.ThrowsException <ArgumentException>(() => { hyperGraph.AddEdge("00", "01", "10"); }, $"This Graph has already an edge '-00-01-10->'."); }