Beispiel #1
0
 public void StartCannotBeNull()
 {
     typeof(BreadthFirst).Invoking(_ =>
                                   BreadthFirst.VisitAll(CreateSimpleGraph(), null).ToList())
     .Should().Throw <ArgumentNullException>()
     .Which.ParamName.Should().Be("start");
 }
Beispiel #2
0
 public void GraphCannotBeNull()
 {
     typeof(BreadthFirst).Invoking(_ =>
                                   BreadthFirst.VisitAll(null, NodeIdentity.Of("A")).ToList())
     .Should().Throw <ArgumentNullException>()
     .Which.ParamName.Should().Be("graph");
 }
Beispiel #3
0
 public void DoesNotVisitDisconnectedNodes()
 {
     BreadthFirst.VisitAll(
         GraphFactory.BuildGraph("A-B", "C-D"), NodeIdentity.Of("A"))
     .Should()
     .ContainInOrder(
         NodeIdentity.Of("A"),
         NodeIdentity.Of("B")
         ).And.HaveCount(2);
 }
Beispiel #4
0
 public void VisitsNodesInOrder()
 {
     BreadthFirst.VisitAll(CreateSimpleGraph(), NodeIdentity.Of("A"))
     .Should().ContainInOrder(
         NodeIdentity.Of("A"),
         NodeIdentity.Of("B1"),
         NodeIdentity.Of("B2"),
         NodeIdentity.Of("C1"),
         NodeIdentity.Of("C2")
         ).And.HaveCount(5);
 }