コード例 #1
0
ファイル: BaseWalkerTest.cs プロジェクト: cip4/JDFLibNet
        public virtual void testDepth()
        {
            BaseWalkerFactory bf = new BaseWalkerFactory();
            BaseWalker        b  = new TestWalker(bf);

            Assert.AreEqual(1, b.getDepth());
        }
コード例 #2
0
ファイル: PackageWalkerTest.cs プロジェクト: grendello/nuget
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
ファイル: PackageWalkerTest.cs プロジェクト: grendello/nuget
        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.");
        }
コード例 #6
0
        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.");
        }
コード例 #7
0
        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.");
        }
コード例 #8
0
ファイル: PackageWalkerTest.cs プロジェクト: Berzeger/NuGet
        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);
        }
コード例 #9
0
ファイル: PackageWalkerTest.cs プロジェクト: Berzeger/NuGet
        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.");
        }
コード例 #10
0
ファイル: PackageWalkerTest.cs プロジェクト: Berzeger/NuGet
        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);
        }