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); }
internal Node(DependencyResolver resolver, MethodInfo method) { _resolver = resolver; Invokable = method; Edges = new SortedList<string, Node>(); }
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); }
public void Resolve_WhereTasksHaveIndirectCircularDependencies_ThrowsCircularTaskDependencyException() { // Arrange var resolver = new DependencyResolver(new IndirectCircularDependency().GetTasks().ToList()); // Act resolver.OrderTasks(); }
public void Resolve_WhereTaskHasDependencyOnSelf_ThrowsCircularTaskDependencyException() { // Arrange var resolver = new DependencyResolver(new SelfCircularDependency().GetTasks().ToList()); // Act resolver.OrderTasks(); }
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); }
public void GetTaskForName_WithInvalidTaskName_ThrowsUnknownTaskException() { // Arrange var resolver = new DependencyResolver(new InvalidTaskDependency().GetTasks().ToList()); // Act resolver.OrderTasks(); }