Esempio n. 1
0
        public void CreateNewOrGetExistingNode_WhenCalled_ChangesCourseNodes()
        {
            CourseDependencyGraph courseGraph = CreateCourseDependencyGraph();
            Course course = courseGraph.CreateNewOrGetExistingNode(GetName());

            Assert.AreEqual(1, courseGraph.GetNodes().Count());
        }
Esempio n. 2
0
        private static CourseDependencyGraph BuildGraphDataStructure(string[] courses, string[][] dependencyArray)
        {
            CourseDependencyGraph courseGraph = new CourseDependencyGraph();

            foreach (var course in courses)
            {
                courseGraph.CreateNewOrGetExistingNode(course);
            }

            foreach (string[] dependency in dependencyArray)
            {
                string firstCourse  = dependency[0];
                string secondCourse = dependency[1];

                courseGraph.AddEdge(firstCourse, secondCourse);
            }

            return(courseGraph);
        }