Exemple #1
0
        TestEdgeToVerticesBad8()
        {
            // Vertices not part of the same graph.

            try
            {
                MockVertex oVertex1 = new MockVertex();
                MockVertex oVertex2 = new MockVertex();

                IGraph oGraph1 = new Graph(GraphDirectedness.Mixed);
                IGraph oGraph2 = new Graph(GraphDirectedness.Mixed);

                oVertex1.ParentGraph = oGraph1;
                oVertex2.ParentGraph = oGraph2;

                IEdge oEdge = new MockEdge(oVertex1, oVertex2, false, false, 2);

                IVertex oVertexA, oVertexB;

                EdgeUtil.EdgeToVertices(oEdge, ClassName, MethodOrPropertyName,
                                        out oVertexA, out oVertexB);
            }
            catch (ApplicationException oApplicationException)
            {
                Assert.AreEqual(

                    "TheClass.TheMethodOrProperty: The edge connects vertices not"
                    + " in the same graph."
                    ,
                    oApplicationException.Message
                    );

                throw oApplicationException;
            }
        }
Exemple #2
0
        TestEdgeToVerticesBad7()
        {
            // Second vertex has no parent.

            try
            {
                MockVertex oVertex1 = new MockVertex();
                MockVertex oVertex2 = new MockVertex();

                IGraph oGraph = new Graph();

                oVertex1.ParentGraph = oGraph;
                // oVertex2.ParentGraph = oGraph;

                IEdge oEdge = new MockEdge(oVertex1, oVertex2, false, false, 2);

                IVertex oVertexA, oVertexB;

                EdgeUtil.EdgeToVertices(oEdge, ClassName, MethodOrPropertyName,
                                        out oVertexA, out oVertexB);
            }
            catch (ApplicationException oApplicationException)
            {
                Assert.AreEqual(

                    "TheClass.TheMethodOrProperty: The edge's second vertex does"
                    + " not belong to a graph."
                    ,
                    oApplicationException.Message
                    );

                throw oApplicationException;
            }
        }
Exemple #3
0
        TestEdgeToVertices()
        {
            // Valid vertices.

            MockVertex oVertex1 = new MockVertex();
            MockVertex oVertex2 = new MockVertex();

            IGraph oGraph = new Graph();

            oVertex1.ParentGraph = oGraph;
            oVertex2.ParentGraph = oGraph;

            IEdge oEdge = new MockEdge(oVertex1, oVertex2, false, false, 2);

            IVertex oVertexA, oVertexB;

            EdgeUtil.EdgeToVertices(oEdge, ClassName, MethodOrPropertyName,
                                    out oVertexA, out oVertexB);

            Assert.AreEqual(oVertex1, oVertexA);
            Assert.AreEqual(oVertex2, oVertexB);
        }
        public void TestAdd4_Bad6()
        {
            // Second vertex is of wrong type.

            try
            {
            InitializeGraph(GraphDirectedness.Undirected);

            IVertex [] aoVertices = AddVertices(1);

            MockVertex oWrongTypeVertex = new MockVertex();

            oWrongTypeVertex.ParentGraph = m_oGraph;

            m_oEdgeCollection.Add(aoVertices[0], oWrongTypeVertex);
            }
            catch (ArgumentException oArgumentException)
            {
            Assert.AreEqual(
                "Microsoft.NodeXL.Core."
                + "EdgeCollection.Add: The edge is invalid.\r\n"
                + "Parameter name: edge"
                ,
                oArgumentException.Message
                );

            Assert.IsNotNull(oArgumentException.InnerException);

            Assert.AreEqual(

                "Microsoft.NodeXL.Core."
                + "EdgeCollection.Add: A vertex is not of type Vertex.  The"
                + " type is Microsoft.NodeXL"
                + ".UnitTests.MockVertex."
                ,
                oArgumentException.InnerException.Message
                );

            throw oArgumentException;
            }
        }
        public void TestAddBad9()
        {
            // First vertex is of wrong type.

            try
            {
            IVertex [] aoVertices = AddVertices(1);

            MockVertex oWrongTypeVertex = new MockVertex();

            oWrongTypeVertex.ParentGraph = m_oGraph;

            IEdge oEdge = new MockEdge(
                oWrongTypeVertex, aoVertices[0], false, false, 2);

            m_oEdgeCollection.Add(oEdge);
            }
            catch (ArgumentException oArgumentException)
            {
            Assert.AreEqual(
                "Microsoft.NodeXL.Core."
                + "EdgeCollection.Add: The edge is invalid.\r\n"
                + "Parameter name: edge"
                ,
                oArgumentException.Message
                );

            Assert.IsNotNull(oArgumentException.InnerException);

            Assert.AreEqual(

                "Microsoft.NodeXL.Core."
                + "EdgeCollection.Add: A vertex is not of type Vertex.  The"
                + " type is Microsoft.NodeXL"
                + ".UnitTests.MockVertex."
                ,
                oArgumentException.InnerException.Message
                );

            throw oArgumentException;
            }
        }