Exemplo n.º 1
0
        public void TestResolver()
        {
            // Arrange
            var t = typeof(Resolver);
            var resolver = new DependencyResolver(new Resolver().GetTasks().ToList());

            var expected = new List<MethodInfo>
            {
                t.GetMethod("Task2"),
                t.GetMethod("Task1"),
                t.GetMethod("Task3"),
                t.GetMethod("Task5"),
                t.GetMethod("Task4")
            };

            // Act
            var actual = resolver.OrderTasks().ToList();

            // Assert
            CollectionAssert.AreEqual(expected, actual);
        }
Exemplo n.º 2
0
        public void Resolve_WhereTasksHaveNoDependencies_OrdersLexigraphically()
        {
            // Arrange
            var t = typeof(NoDependencies);
            var resolver = new DependencyResolver(new NoDependencies().GetTasks().ToList());

            var expected = new List<MethodInfo>
            {
                t.GetMethod("ATask"),
                t.GetMethod("KTask"),
                t.GetMethod("ZTask")
            };

            // Act
            var actual = resolver.OrderTasks().ToList();

            // Assert
            CollectionAssert.AreEqual(expected, actual);
        }
Exemplo n.º 3
0
        public void Resolve_WhereTasksHaveIndirectCircularDependencies_ThrowsCircularTaskDependencyException()
        {
            // Arrange
            var resolver = new DependencyResolver(new IndirectCircularDependency().GetTasks().ToList());

            // Act
            resolver.OrderTasks();
        }
Exemplo n.º 4
0
        public void Resolve_WhereTaskHasDependencyOnSelf_ThrowsCircularTaskDependencyException()
        {
            // Arrange
            var resolver = new DependencyResolver(new SelfCircularDependency().GetTasks().ToList());

            // Act
            resolver.OrderTasks();
        }
Exemplo n.º 5
0
        public void Resolve_WhereTaskEnablesMultipleExecutionForStandaloneTask_IncludesTaskMultipleTimes()
        {
            // Arrange
            var t = typeof(WithMultipleExecutionStandalone);
            var resolver = new DependencyResolver(new WithMultipleExecutionStandalone().GetTasks().ToList());

            var expected = new List<MethodInfo>
            {
                t.GetMethod("Task1"),
                t.GetMethod("Task1"),
                t.GetMethod("Task2"),
                t.GetMethod("Task1"),
                t.GetMethod("Task3"),
                t.GetMethod("Task4")
            };

            // Act
            var actual = resolver.OrderTasks().ToList();

            // Assert
            CollectionAssert.AreEqual(expected, actual);
        }
Exemplo n.º 6
0
        public void GetTaskForName_WithInvalidTaskName_ThrowsUnknownTaskException()
        {
            // Arrange
            var resolver = new DependencyResolver(new InvalidTaskDependency().GetTasks().ToList());

            // Act
            resolver.OrderTasks();
        }