Exemplo n.º 1
0
        public void DoesNotAllowDuplicates()
        {
            var list = CreatePointList();

            list.Add(list[0]);
            Graph.Graph <GameObject> graph = new Graph.Graph <GameObject>();
            graph.AddNodes(list);

            Assert.IsTrue(graph.FindAllNodes(n => n.Item == list[0]).Count == 1);
        }
Exemplo n.º 2
0
        public void DoesNotAllowDuplicatesSameCoordinate()
        {
            var list = CreatePointList();
            var g    = new GameObject();
            var g2   = new GameObject();
            var x    = Random.Range(-5.0f, 5.0f);
            var y    = Random.Range(-5.0f, 5.0f);

            g.transform.position  = new Vector3(x, y, 0.0f);
            g2.transform.position = new Vector3(x, y, 0.0f);

            list.Add(g);
            list.Add(g2);

            Graph.Graph <GameObject> graph = new Graph.Graph <GameObject>();
            graph.AddNodes(list);

            Assert.IsTrue(graph.FindAllNodes(n => n.Item.transform.position == g.transform.position).Count == 1);
        }