public void AddEdgeThrowsContractException200() { try { AdjacencyGraph <int, Edge <int> > adjacencyGraph; Edge <int> edge; bool b; KeyValuePair <int, int>[] keyValuePairs = new KeyValuePair <int, int> [0]; adjacencyGraph = AdjacencyGraphFactory.Create(false, keyValuePairs); edge = EdgeFactory.Create(0, 0); b = this.AddEdge <int, Edge <int> >(adjacencyGraph, edge); throw new AssertFailedException(); } catch (Exception ex) { if (!PexContract.IsContractException(ex)) { throw ex; } } }
public void MergeVertexIf(VertexPredicate <TVertex> vertexPredicate, EdgeFactory <TVertex, TEdge> edgeFactory) { Contract.Requires(vertexPredicate != null); Contract.Requires(edgeFactory != null); // storing vertices to merge var mergeVertices = new VertexList <TVertex>(this.VertexCount / 4); foreach (var v in this.Vertices) { if (vertexPredicate(v)) { mergeVertices.Add(v); } } // applying merge recursively foreach (var v in mergeVertices) { MergeVertex(v, edgeFactory); } }