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

            var src = 1;

            var expectedEdgeData =
                _adjacency[src].Select(dstIdx => GetEdgeValue(src, dstIdx)).ToArray();

            // Act
            var edges = uut.GetEdgesFromVertexAt(src).ToArray();

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