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

            // Act
            var res = uut.GetEdges().Count();

            // Assert
            Assert.AreEqual(_edgesCount, res);
        }
Esempio n. 2
0
        public void ON_GetEdges_WHEN_Edges_Defined_SHOULD_Return_All_Defined_Edges()
        {
            // Arrange
            var uut = new UnitUnderTest <int>(index => _vertexMocks[index].Object, () => _vertexMocks.Length);

            var values = new HashSet <int>(_adjacency.SelectMany((a, srcIdx) => a.Select(dstIdx => GetEdgeValue(srcIdx, dstIdx))));

            // Act
            var res = uut.GetEdges();

            // Assert
            foreach (var edge in res)
            {
                Assert.IsTrue(values.Remove(edge.Data));
            }

            Assert.AreEqual(0, values.Count);
        }