|
3 | 3 | namespace CombatDicesTeam.Graphs.Tests;
|
4 | 4 |
|
5 | 5 | public class DirectedGraphTests
|
6 |
| -{ |
7 |
| - /// <summary> |
8 |
| - /// Test checks a node from the middle of linear directed graph returns related node from the end as next. |
9 |
| - /// </summary> |
10 |
| - [Test] |
11 |
| - public void GetNext_LinearGraph3_ReturnsSingleNodeFromRoot() |
12 |
| - { |
13 |
| - // ARRANGE |
14 |
| - |
15 |
| - var graph = new DirectedGraph<int>(); |
16 |
| - |
17 |
| - var nodeList = new List<IGraphNode<int>>(); |
18 |
| - const int SEQUENCE_LENGTH = 3; |
19 |
| - for (var i = 0; i < SEQUENCE_LENGTH; i++) |
20 |
| - { |
21 |
| - var nodePayload = i; |
22 |
| - var graphNode = Mock.Of<IGraphNode<int>>(x => x.Payload == nodePayload); |
23 |
| - nodeList.Add(graphNode); |
24 |
| - } |
25 |
| - |
26 |
| - CreateLinearGraph(graph, nodeList); |
27 |
| - |
28 |
| - // ACT |
29 |
| - |
30 |
| - var next = graph.GetNext(nodeList[1]); |
31 |
| - |
32 |
| - // ASSERT |
33 |
| - |
34 |
| - next.Should().HaveCount(1).And.Subject.Should().Satisfy(x => x == nodeList[2]); |
35 |
| - } |
36 |
| - |
37 |
| - /// <summary> |
38 |
| - /// Test checks a root returns related node as next. |
39 |
| - /// </summary> |
| 6 | +{ |
| 7 | + /// <summary> |
| 8 | + /// Test checks a node from the middle of linear directed graph returns related node from the end as next. |
| 9 | + /// </summary> |
| 10 | + [Test] |
| 11 | + public void GetNext_LinearGraph3_ReturnsSingleNodeFromRoot() |
| 12 | + { |
| 13 | + // ARRANGE |
| 14 | + |
| 15 | + var graph = new DirectedGraph<int>(); |
| 16 | + |
| 17 | + var nodeList = new List<IGraphNode<int>>(); |
| 18 | + const int SEQUENCE_LENGTH = 3; |
| 19 | + for (var i = 0; i < SEQUENCE_LENGTH; i++) |
| 20 | + { |
| 21 | + var nodePayload = i; |
| 22 | + var graphNode = Mock.Of<IGraphNode<int>>(x => x.Payload == nodePayload); |
| 23 | + nodeList.Add(graphNode); |
| 24 | + } |
| 25 | + |
| 26 | + CreateLinearGraph(graph, nodeList); |
| 27 | + |
| 28 | + // ACT |
| 29 | + |
| 30 | + var next = graph.GetNext(nodeList[1]); |
| 31 | + |
| 32 | + // ASSERT |
| 33 | + |
| 34 | + next.Should().HaveCount(1).And.Subject.Should().Satisfy(x => x == nodeList[2]); |
| 35 | + } |
| 36 | + |
| 37 | + /// <summary> |
| 38 | + /// Test checks a root returns related node as next. |
| 39 | + /// </summary> |
40 | 40 | [Test]
|
41 | 41 | public void GetNext_SimplestGraph_ReturnsSingleOtherNode()
|
42 | 42 | {
|
|
0 commit comments