Ejemplo n.º 1
0
        public void ON_GetEdgesToVertexAt_WHEN_Vertex_Exists_SHOULD_Return_Defined_Edges()
        {
            // Arrange
            var uut = new UnitUnderTest <int>(index => _vertexMocks[index].Object, () => _vertexMocks.Length);

            var dest = 1;

            var expectedEdgeData =
                _adjacency.SelectMany((a, srcIdx) => a.Where(idx => idx == dest).Select(dstIdx => GetEdgeValue(srcIdx, dstIdx))).ToArray();

            // Act
            var edges = uut.GetEdgesToVertexAt(dest).ToArray();

            // Assert
            Assert.IsTrue(edges.All(e => e.Destination == dest));
            Assert.IsTrue(edges.All(e => _adjacency[e.Source].Contains(e.Destination)));
            CollectionAssert.AreEquivalent(expectedEdgeData, edges.Select(e => e.Data).ToArray());
        }