public void ProgressChanged_Simple() { var graph = new AdjacencyGraph <TestVertex, Edge <TestVertex> >(); var algorithm = new TestSimpleLayoutAlgorithm(graph); var progresses = new Stack <double>(new[] { 100.0, 50.0, 0.0 }); algorithm.ProgressChanged += (sender, percent) => Assert.AreEqual(progresses.Pop(), percent); algorithm.Compute(); CollectionAssert.IsEmpty(progresses); }
public void IterationEnded_Simple() { var graph = new AdjacencyGraph <TestVertex, Edge <TestVertex> >(); var algorithm = new TestSimpleLayoutAlgorithm(graph); var arguments = new LayoutIterationEventArgs <TestVertex, Edge <TestVertex> >(1, 100.0); algorithm.Args = arguments; var iterations = new Stack <ILayoutIterationEventArgs <TestVertex> >(new[] { arguments }); algorithm.IterationEnded += (sender, args) => Assert.AreSame(iterations.Pop(), args); algorithm.Compute(); Assert.AreEqual(ComputationState.Finished, algorithm.State); CollectionAssert.IsEmpty(iterations); }