本文整理汇总了C#中ModuleCatalog.CompleteListWithDependencies方法的典型用法代码示例。如果您正苦于以下问题:C# ModuleCatalog.CompleteListWithDependencies方法的具体用法?C# ModuleCatalog.CompleteListWithDependencies怎么用?C# ModuleCatalog.CompleteListWithDependencies使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModuleCatalog
的用法示例。
在下文中一共展示了ModuleCatalog.CompleteListWithDependencies方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanCompleteListWithTheirDependencies
public void CanCompleteListWithTheirDependencies()
{
// A <- B <- C
var moduleInfoA = CreateModuleInfo("A");
var moduleInfoB = CreateModuleInfo("B", "A");
var moduleInfoC = CreateModuleInfo("C", "B");
var moduleInfoOrphan = CreateModuleInfo("X", "B");
List<ModuleInfo> moduleInfos = new List<ModuleInfo>
{
moduleInfoA
, moduleInfoB
, moduleInfoC
, moduleInfoOrphan
};
var moduleCatalog = new ModuleCatalog(moduleInfos);
IEnumerable<ModuleInfo> dependantModules = moduleCatalog.CompleteListWithDependencies(new[] { moduleInfoC });
Assert.AreEqual(3, dependantModules.Count());
Assert.IsTrue(dependantModules.Contains(moduleInfoA));
Assert.IsTrue(dependantModules.Contains(moduleInfoB));
Assert.IsTrue(dependantModules.Contains(moduleInfoC));
}
示例2: CompleteListWithDependenciesThrowsWithNull
public void CompleteListWithDependenciesThrowsWithNull()
{
var catalog = new ModuleCatalog();
catalog.CompleteListWithDependencies(null);
}
示例3: ShouldReturnInCorrectRetrieveOrderWhenCompletingListWithDependencies
public void ShouldReturnInCorrectRetrieveOrderWhenCompletingListWithDependencies()
{
// A <- B <- C <- D, C <- X
var moduleA = CreateModuleInfo("A");
var moduleB = CreateModuleInfo("B", "A");
var moduleC = CreateModuleInfo("C", "B");
var moduleD = CreateModuleInfo("D", "C");
var moduleX = CreateModuleInfo("X", "C");
var moduleCatalog = new ModuleCatalog();
// Add the modules in random order
moduleCatalog.AddModule(moduleB);
moduleCatalog.AddModule(moduleA);
moduleCatalog.AddModule(moduleD);
moduleCatalog.AddModule(moduleX);
moduleCatalog.AddModule(moduleC);
var dependantModules = moduleCatalog.CompleteListWithDependencies(new[] { moduleD, moduleX }).ToList();
Assert.AreEqual(5, dependantModules.Count);
Assert.IsTrue(dependantModules.IndexOf(moduleA) < dependantModules.IndexOf(moduleB));
Assert.IsTrue(dependantModules.IndexOf(moduleB) < dependantModules.IndexOf(moduleC));
Assert.IsTrue(dependantModules.IndexOf(moduleC) < dependantModules.IndexOf(moduleD));
Assert.IsTrue(dependantModules.IndexOf(moduleC) < dependantModules.IndexOf(moduleX));
}
示例4: CompleteListWithDependenciesThrowsWithNull
public void CompleteListWithDependenciesThrowsWithNull()
{
var catalog = new ModuleCatalog();
Assert.ThrowsException<ArgumentNullException>(() => catalog.CompleteListWithDependencies(null));
}