Beispiel #1
0
        public void ReadEdgeString_Reads_Edge_From_Input_And_Reads_Weight_If_Present(string inputStr, double expectedWeight)
        {
            //Arrange
            bool result = false;
            int srcV = -1;
            int targV = -1;
            double weight = double.NaN;

            NetFileReader reader = new NetFileReader();

            //Act
            result = reader.ReadEdgeString(inputStr, out srcV, out targV, out weight);

            //Assert
            Assert.True(result);
            Assert.Equal(expectedWeight, weight);
            if (weight == expectedWeight)
            {
                Assert.True(result);
            }
        }
Beispiel #2
0
        public void ReadEdgeString_Returns_False_For_Invalid_Input(string inputStr, int expectedSrcVtxNum, int expectedTargVtxNum)
        {
            //Arrange
            bool result = false;
            int srcV = -1;
            int targV = -1;
            double weight = double.NaN;

            NetFileReader reader = new NetFileReader();

            //Act
            result = reader.ReadEdgeString(inputStr, out srcV, out targV, out weight);

            //Assert
            Assert.False(result);
            Assert.Equal(expectedSrcVtxNum, srcV);
            Assert.Equal(expectedTargVtxNum, targV);
        }
Beispiel #3
0
        public void ReadEdgeString_Reads_Edge_From_Input_Including_Vertex_Numbers(string inputStr, int expectedSrcVtxNum, int expectedTargVtxNum)
        {
            //Arrange
            bool result = false;
            int srcV = -1;
            int targV = -1;
            double weight = double.NaN;

            NetFileReader reader = new NetFileReader();

            //Act
            result = reader.ReadEdgeString(inputStr, out srcV, out targV, out weight );

            //Assert
            Assert.True(result);
            Assert.Equal(expectedSrcVtxNum, srcV);
            Assert.Equal(expectedTargVtxNum, targV);
            if (srcV == expectedSrcVtxNum && targV == expectedTargVtxNum)
            {
                Assert.True(result);
            }
        }