Exemplo n.º 1
0
        private HalfEdgeStructure CheckTraceAndGraph(Point[] points, string[] expected)
        {
            var myListener = new TestTraceListener();
              try
              {
            Trace.Listeners.Add(myListener);

            var edgeGraph = VoroniBuilder.MakeDiagram(points);
            var theTrace = myListener.GetTrace();

            //perhaps there are extra things in the trace. But we should have all of expected[] in order
            int i = 0;
            foreach (var actual in theTrace)
            {
              if (i >= expected.Length) break;
              if (actual.StartsWith(expected[i]))
            i++;
            }
            Assert.AreEqual(i, expected.Length);

            CheckEdgeGraph(edgeGraph);
            return edgeGraph;
              }
              finally
              { Trace.Listeners.Remove(myListener); }
        }