Beispiel #1
0
        public void ModulesGraph_Basic()
        {
            Assert.That(_g.Modules.Count, Is.EqualTo(5));

            var result = _g.GetDependencies(_a, DependencyDirection.Downstream, DependencyLevel.DirectOnly);

            Assert.That(result.Count, Is.EqualTo(3));
            Assert.IsNotNull(FindModule(result, "B1"));
            Assert.IsNotNull(FindModule(result, "B2"));
            Assert.IsNotNull(FindModule(result, "B3"));


            result = _g.GetDependencies(_a, DependencyDirection.Downstream, DependencyLevel.Everything);
            Assert.That(result.Count, Is.EqualTo(4));
            Assert.IsNotNull(FindModule(result, "B1"));
            Assert.IsNotNull(FindModule(result, "B2"));
            Assert.IsNotNull(FindModule(result, "B3"));
            Assert.IsNotNull(FindModule(result, "C1"));


            result = _g.GetDependencies(_b1, DependencyDirection.Downstream, DependencyLevel.Everything);
            Assert.That(result.Count, Is.EqualTo(1));
            Assert.IsNotNull(FindModule(result, "C1"));

            result = _g.GetDependencies(_c1, DependencyDirection.Upstream, DependencyLevel.DirectOnly);
            Assert.That(result.Count, Is.EqualTo(1));
            Assert.IsNotNull(FindModule(result, "B1"));

            result = _g.GetDependencies(_c1, DependencyDirection.Upstream, DependencyLevel.Everything);
            Assert.That(result.Count, Is.EqualTo(2));
            Assert.IsNotNull(FindModule(result, "B1"));
            Assert.IsNotNull(FindModule(result, "A"));

            result = _g.GetDependencies(_a, DependencyDirection.Upstream, DependencyLevel.Everything);
            Assert.That(result.Count, Is.EqualTo(0));
        }
Beispiel #2
0
        public IList <ViewModels.Module> Get(int moduleId, DependencyDirection direction, DependencyLevel level)
        {
            var items = _graph.GetDependencies(moduleId, direction, level);

            return(Mapper.Map <List <ViewModels.Module> >(items));
        }