Exemplo n.º 1
0
        public void ToFrame_Returns_Null_If_Input_Network_Is_Not_A_Matrix()
        {
            //Arrange
            IBasicAdjList net = BasicAdjListGenerator.GenerateAdjList(2, 2, true);

            var converter = new MatrixToFrameConverter();

            //Act
            IFrame frame = converter.ToFrame(net);

            //Assert
            Assert.Null(frame);
        }
Exemplo n.º 2
0
        public void ToFrame(int nodeCount, int edgeCount, bool directed, bool selfLoops)
        {
            Console.WriteLine(
                string.Format("nodes: {0}, edges:{1}, directed:{2}, self-loops:{3}",
                              nodeCount, edgeCount, directed, selfLoops));
            //Arrange
            BasicMatrixGenerator.AllowSelfLoops = selfLoops;
            IMatrix<double> net = BasicMatrixGenerator.GenerateMatrix(Guid.NewGuid(), nodeCount, edgeCount, directed);

            var converter = new MatrixToFrameConverter();

            //Act
            IFrame frame = converter.ToFrame(net);

            //Assert
            Assert.NotNull(frame);
            Assert.Equal(net.NodeCount, frame.RowCount);
            Assert.Equal(net.NodeCount, frame.ColumnCount);
        }