public void Visit_givenVisitor_callsVisitEdge() { var visitor = mMockRepository.DynamicMock<IGraphVisitor<string>>(); var node = CreateNode(); var edge = new Edge(node, node); using (mMockRepository.Record()) { Expect.Call(visitor.VisitEdge(null)) .IgnoreArguments() .Return("graph") .Repeat.Once(); } using (mMockRepository.Playback()) { edge.Visit(visitor); } }
public void Visit_missingVisitor_throwsException() { var node = CreateNode(); var edge = new Edge(node, node); edge.Visit<string>(null); }
public void Visit_givenVisitor_returnsVisitEdgeResult() { const string VisitEdgeResult = "graph"; var visitor = mMockRepository.DynamicMock<IGraphVisitor<string>>(); var node = CreateNode(); var edge = new Edge(node, node); using (mMockRepository.Record()) { Expect.Call(visitor.VisitEdge(null)) .IgnoreArguments() .Return(VisitEdgeResult) .Repeat.Once(); } var result = edge.Visit(visitor); Assert.That(result, Is.EqualTo(VisitEdgeResult)); }