public virtual void testDepth() { BaseWalkerFactory bf = new BaseWalkerFactory(); BaseWalker b = new TestWalker(bf); Assert.AreEqual(1, b.getDepth()); }
public void AfterPackageWalkMetaPackageIsClassifiedTheSameAsDependencies() { // Arrange var mockRepository = new MockPackageRepository(); var walker = new TestWalker(mockRepository); IPackage metaPackage = PackageUtility.CreatePackage("A", "1.0", dependencies: new List<PackageDependency> { new PackageDependency("B"), new PackageDependency("C") }); IPackage projectPackageA = PackageUtility.CreatePackage("B", "1.0", content: new[] { "contentB" }); IPackage projectPackageB = PackageUtility.CreatePackage("C", "1.0", content: new[] { "contentC" }); mockRepository.AddPackage(projectPackageA); mockRepository.AddPackage(projectPackageB); Assert.AreEqual(PackageTargets.None, walker.GetPackageInfo(metaPackage).Target); // Act walker.Walk(metaPackage); // Assert Assert.AreEqual(PackageTargets.Project, walker.GetPackageInfo(metaPackage).Target); }
public void AfterPackageWalkMetaPackageIsClassifiedTheSameAsDependencies() { // Arrange var mockRepository = new MockPackageRepository(); var walker = new TestWalker(mockRepository); IPackage metaPackage = PackageUtility.CreatePackage("A", "1.0", dependencies: new List <PackageDependency> { new PackageDependency("B"), new PackageDependency("C") }); IPackage projectPackageA = PackageUtility.CreatePackage("B", "1.0", content: new[] { "contentB" }); IPackage projectPackageB = PackageUtility.CreatePackage("C", "1.0", content: new[] { "contentC" }); mockRepository.AddPackage(projectPackageA); mockRepository.AddPackage(projectPackageB); Assert.AreEqual(PackageTargets.None, walker.GetPackageInfo(metaPackage).Target); // Act walker.Walk(metaPackage); // Assert Assert.AreEqual(PackageTargets.Project, walker.GetPackageInfo(metaPackage).Target); }
public void Test_Leduc() { GameDefinition gd = XmlSerializerExt.Deserialize <GameDefinition>( Props.Global.Expand("${bds.DataDir}ai.pkr.metastrategy/leduc-he.gamedef.xml")); ActionTree at = CreateActionTreeByGameDef.Create(gd); ChanceTree ct = CreateChanceTreeByGameDef.Create(gd); ChanceTree pct = ExtractPlayerChanceTree.ExtractS(ct, 0); TestWalker tw = new TestWalker { ActionTree = at, PlayerChanceTree = pct }; tw.Walk(); Console.WriteLine("Begin: a:{0} c:{1} total:{2}", tw.BeginCount[0], tw.BeginCount[1], tw.BeginCount[0] + tw.BeginCount[1]); Assert.AreEqual(674, tw.BeginCount[0]); Assert.AreEqual(48, tw.BeginCount[1]); Assert.AreEqual(_leduc, tw.Text); }
public void ExternalPackagesThatDepdendOnProjectLevelPackagesThrows() { // Arrange var mockRepository = new MockPackageRepository(); var walker = new TestWalker(mockRepository); IPackage solutionPackage = PackageUtility.CreatePackage("A", "1.0", dependencies: new List<PackageDependency> { new PackageDependency("B") }, tools: new[] { "install.ps1" }); IPackage projectPackageA = PackageUtility.CreatePackage("B", "1.0", content: new[] { "contentB" }); mockRepository.AddPackage(projectPackageA); mockRepository.AddPackage(solutionPackage); // Act && Assert ExceptionAssert.Throws<InvalidOperationException>(() => walker.Walk(solutionPackage), "External packages cannot depend on packages that target projects."); }
public void ExternalPackagesThatDepdendOnProjectLevelPackagesThrows() { // Arrange var mockRepository = new MockPackageRepository(); var walker = new TestWalker(mockRepository); IPackage solutionPackage = PackageUtility.CreatePackage("A", "1.0", dependencies: new List <PackageDependency> { new PackageDependency("B") }, tools: new[] { "install.ps1" }); IPackage projectPackageA = PackageUtility.CreatePackage("B", "1.0", content: new[] { "contentB" }); mockRepository.AddPackage(projectPackageA); mockRepository.AddPackage(solutionPackage); // Act && Assert ExceptionAssert.Throws <InvalidOperationException>(() => walker.Walk(solutionPackage), "External packages cannot depend on packages that target projects."); }
public void MetaPackageWithMixedTargetsThrows() { // Arrange var mockRepository = new MockPackageRepository(); var walker = new TestWalker(mockRepository); IPackage metaPackage = PackageUtility.CreatePackage("A", "1.0", dependencies: new List <PackageDependency> { new PackageDependency("B"), new PackageDependency("C") }); IPackage projectPackageA = PackageUtility.CreatePackage("B", "1.0", content: new[] { "contentB" }); IPackage solutionPackage = PackageUtility.CreatePackage("C", "1.0", tools: new[] { "tools" }); mockRepository.AddPackage(projectPackageA); mockRepository.AddPackage(solutionPackage); // Act && Assert ExceptionAssert.Throws <InvalidOperationException>(() => walker.Walk(metaPackage), "Child dependencies of dependency only packages cannot mix external and project packages."); }
public void LocalizedIntelliSenseFileCountsAsProjectTarget() { // Arrange var mockRepository = new MockPackageRepository(); var walker = new TestWalker(mockRepository); IPackage runtimePackage = PackageUtility.CreatePackage("A", "1.0", assemblyReferences: new[] { @"lib\A.dll", @"lib\A.xml" }); IPackage satellitePackage = PackageUtility.CreatePackage("A.fr-fr", "1.0", dependencies: new[] { new PackageDependency("A") }, satelliteAssemblies: new[] { @"lib\fr-fr\A.xml" }, language: "fr-fr"); mockRepository.AddPackage(runtimePackage); mockRepository.AddPackage(satellitePackage); // Act walker.Walk(satellitePackage); // Assert Assert.Equal(PackageTargets.Project, walker.GetPackageInfo(satellitePackage).Target); }
public void MetaPackageWithMixedTargetsThrows() { // Arrange var mockRepository = new MockPackageRepository(); var walker = new TestWalker(mockRepository); IPackage metaPackage = PackageUtility.CreatePackage("A", "1.0", dependencies: new List<PackageDependency> { new PackageDependency("B"), new PackageDependency("C") }); IPackage projectPackageA = PackageUtility.CreatePackage("B", "1.0", content: new[] { "contentB" }); IPackage solutionPackage = PackageUtility.CreatePackage("C", "1.0", tools: new[] { "tools" }); mockRepository.AddPackage(projectPackageA); mockRepository.AddPackage(solutionPackage); // Act && Assert ExceptionAssert.Throws<InvalidOperationException>(() => walker.Walk(metaPackage), "Child dependencies of dependency only packages cannot mix external and project packages."); }
public void AfterPackageWalkSatellitePackageIsClassifiedTheSameAsDependencies() { // Arrange var mockRepository = new MockPackageRepository(); var walker = new TestWalker(mockRepository); IPackage runtimePackage = PackageUtility.CreatePackage("A", "1.0", assemblyReferences: new[] { @"lib\A.dll" }); IPackage satellitePackage = PackageUtility.CreatePackage("A.fr-fr", "1.0", dependencies: new[] { new PackageDependency("A") }, satelliteAssemblies: new[] { @"lib\fr-fr\A.resources.dll" }, language: "fr-fr"); mockRepository.AddPackage(runtimePackage); mockRepository.AddPackage(satellitePackage); // Act walker.Walk(satellitePackage); // Assert Assert.Equal(PackageTargets.Project, walker.GetPackageInfo(satellitePackage).Target); }