本文整理汇总了C#中Graph.AddPackageDefinition方法的典型用法代码示例。如果您正苦于以下问题:C# Graph.AddPackageDefinition方法的具体用法?C# Graph.AddPackageDefinition怎么用?C# Graph.AddPackageDefinition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graph
的用法示例。
在下文中一共展示了Graph.AddPackageDefinition方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Graph
public void SortTopologicallyAsString_returns_dependency_package_before_the_package_itself_regardless_of_addition_order_to_graph()
{
Graph graph = new Graph();
PackageDefinition definitionB = new PackageDefinition("B");
PackageDefinition definitionA = new PackageDefinition("A:B");
graph.AddPackageDefinition(definitionB);
graph.AddPackageDefinition(definitionA);
string sortedList = graph.SortTopologicallyAsString();
Assert.AreEqual("B, A", sortedList);
}
示例2: AddNode_adds_node_into_list
public void AddNode_adds_node_into_list()
{
Graph graph = new Graph();
PackageDefinition definition = new PackageDefinition("A");
graph.AddPackageDefinition(definition);
Assert.IsTrue(graph.Contains(definition.Package));
}
示例3: SortTopologicallyAsString_does_not_scan_dependencies_for_Visited_packages
public void SortTopologicallyAsString_does_not_scan_dependencies_for_Visited_packages()
{
Graph graph = new Graph();
PackageDefinition definitionA = new PackageDefinition("A:B");
definitionA.MarkAsAdded();
graph.AddPackageDefinition(definitionA);
Queue<string> result = graph.SortTopologically();
Assert.IsEmpty(result);
}
示例4: SortTopologicallyAsString_throws_exception_if_package_definitions_contain_cycle
public void SortTopologicallyAsString_throws_exception_if_package_definitions_contain_cycle()
{
Graph graph = new Graph();
PackageDefinition definitionA = new PackageDefinition("A:B");
PackageDefinition definitionB = new PackageDefinition("B:A");
graph.AddPackageDefinition(definitionA);
graph.AddPackageDefinition(definitionB);
Assert.Throws<InvalidOperationException>(() => graph.SortTopologically());
}
示例5: SortTopologicallyAsString_returns_the_node_if_it_has_no_dependency_list
public void SortTopologicallyAsString_returns_the_node_if_it_has_no_dependency_list()
{
Graph graph = new Graph();
PackageDefinition definition = new PackageDefinition("A");
graph.AddPackageDefinition(definition);
string sortedList = graph.SortTopologicallyAsString();
Assert.AreEqual("A", sortedList);
}
示例6: SortTopologically_returns_the_node_if_it_has_no_dependency_list
public void SortTopologically_returns_the_node_if_it_has_no_dependency_list()
{
Graph graph = new Graph();
PackageDefinition definition = new PackageDefinition("A");
graph.AddPackageDefinition(definition);
Queue<string> sortedQueue = graph.SortTopologically();
Assert.IsTrue(sortedQueue.Count == 1);
Assert.AreEqual(definition.Package, sortedQueue.Peek());
}