Exemplo n.º 1
0
 public GraphContainer()
 {
     InitializeComponent();
     parent = Application.Current.MainWindow as MainWindow;
     graph  = new GraphWirth(1);
     mainCanvas.SizeChanged += mainCanvas_SizeChanged;
 }
Exemplo n.º 2
0
        public void TestAddVertex()
        {
            GraphWirth a        = new GraphWirth();
            bool       expected = true;
            bool       actual   = a.AddVertex(15);

            Assert.AreEqual(expected, actual, "Error adding vertex.");
        }
Exemplo n.º 3
0
        public void TestDeleteVertex_NotExistant()
        {
            GraphWirth a        = new GraphWirth();
            bool       expected = false;
            bool       actual   = a.DeleteVertex(15);

            Assert.AreEqual(expected, actual, "Non-existant vertex can not be deleated.");
        }
Exemplo n.º 4
0
        public void TestAddDirectEdge()
        {
            GraphWirth a        = new GraphWirth();
            bool       expected = true;

            a.AddVertex(0);
            bool actual = a.AddDirectEdge(1, 2, 0);

            Assert.AreEqual(expected, actual, "Error adding direct edge.");
        }
Exemplo n.º 5
0
        public void TestDeleteVertex_LastOfTwo()
        {
            GraphWirth a        = new GraphWirth();
            bool       expected = true;

            a.AddVertex(15, 1000);
            bool actual = a.DeleteVertex(15);

            Assert.AreEqual(expected, actual, "Error deleting last of two vertexes.");
        }
Exemplo n.º 6
0
        public void TestAddVertex_WithExistingID()
        {
            GraphWirth a        = new GraphWirth();
            bool       expected = false;

            a.AddVertex(15);
            bool actual = a.AddVertex(15);

            Assert.AreEqual(expected, actual, "Vertex with this key is already exists.");
        }
Exemplo n.º 7
0
        public void TestDeleteVertex()
        {
            GraphWirth a        = new GraphWirth();
            bool       expected = true;

            a.AddVertex(15, 20);
            a.AddVertex(20);
            bool actual = a.DeleteVertex(15);

            Assert.AreEqual(expected, actual, "Unable to delete vertex.");
        }
Exemplo n.º 8
0
        public void TestDeleteUndirectEdge_ToFrom()
        {
            GraphWirth a        = new GraphWirth();
            bool       expected = true;

            a.AddVertex(0);
            a.AddDirectEdge(1, 2, 0);
            bool actual = a.DeleteDirectEdge(2, 1);

            Assert.AreEqual(expected, actual, "Error deleting undirect edge.");
        }
Exemplo n.º 9
0
        public void TestDeleteDirectEdge_ToFrom()
        {
            GraphWirth a        = new GraphWirth();
            bool       expected = false;

            a.AddVertex(0);
            a.AddDirectEdge(1, 2, 0);
            bool actual = a.DeleteDirectEdge(2, 1);

            Assert.AreEqual(expected, actual, "Incorrect order of vertexes while deleting direct edge.");
        }
Exemplo n.º 10
0
        public void TestDeleteVertex_FirstOfMany()
        {
            GraphWirth a        = new GraphWirth();
            bool       expected = true;

            a.AddVertex(10);
            a.AddVertex(100);
            a.AddVertex(1000);
            bool actual = a.DeleteVertex(1);

            Assert.AreEqual(expected, actual, "Error deleting first vertex.");
        }