コード例 #1
0
ファイル: PackTest.cs プロジェクト: qipa/UniGet
        private void Test_Simple()
        {
            // Act

            PackTool.Process(new PackTool.Options
            {
                ProjectFile     = TestHelper.GetDataPath("Simple.json"),
                OutputDirectory = TestHelper.GetOutputPath()
            });

            // Assert

            var unpackPath = TestHelper.CreateOutputPath("Unpack");

            Extracter.ExtractUnityPackage(TestHelper.GetOutputPath() + "/Simple.1.0.0.unitypackage", unpackPath, "Simple", true, true);

            var packagePath = Path.Combine(unpackPath, "Assets", "UnityPackages", "Simple");

            AssertFileExistsWithMeta(packagePath, "../Simple.unitypackage.json");
            AssertFileExistsWithMeta(packagePath, "Text1.txt");
            AssertFileExistsWithMeta(packagePath, "Text2.txt");
            AssertFileExistsWithMeta(packagePath, "SubDir", "TextInSubDir.txt");

            AssertFileExists(unpackPath, "Assets", "UnityPackages.meta");
            AssertFileExists(unpackPath, "Assets", "UnityPackages", "Simple.meta");
            AssertFileExists(unpackPath, "Assets", "UnityPackages", "Simple", "SubDir.meta");
        }
コード例 #2
0
ファイル: PackTest.cs プロジェクト: qipa/UniGet
        private void Test_MergeDependencies()
        {
            // Arrange

            PackTool.Process(new PackTool.Options
            {
                ProjectFile     = TestHelper.GetDataPath("DepA.json"),
                OutputDirectory = TestHelper.GetOutputPath()
            });

            // Act

            PackTool.Process(new PackTool.Options
            {
                ProjectFile              = TestHelper.GetDataPath("DepB-Full.json"),
                OutputDirectory          = TestHelper.GetOutputPath(),
                LocalRepositoryDirectory = TestHelper.GetOutputPath()
            });

            // Assert

            var unpackPath = TestHelper.CreateOutputPath("Unpack");

            Extracter.ExtractUnityPackage(TestHelper.GetOutputPath() + "/DepB.1.0.0.unitypackage", unpackPath, "DepB", true, true);
        }
コード例 #3
0
ファイル: PackTest.cs プロジェクト: qipa/UniGet
        private void Test_FileItem()
        {
            // Act

            PackTool.Process(new PackTool.Options
            {
                ProjectFile     = TestHelper.GetDataPath("FileItem.json"),
                OutputDirectory = TestHelper.GetOutputPath()
            });

            // Assert

            var unpackPath = TestHelper.CreateOutputPath("Unpack");

            Extracter.ExtractUnityPackage(TestHelper.GetOutputPath() + "/FileItem.1.0.0.unitypackage", unpackPath, "FileItem", true, true);

            var basePath = Path.Combine(unpackPath, "Assets", "UnityPackages");

            AssertFileExistsWithMeta(basePath, "FileItem.unitypackage.json");
            AssertFileExistsWithMeta(basePath, "1/Text.txt");
            AssertFileExistsWithMeta(basePath, "2/Text.txt");

            AssertFileExists(unpackPath, "Assets", "UnityPackages.meta");
            AssertFileExists(unpackPath, "Assets", "UnityPackages", "1.meta");
            AssertFileExists(unpackPath, "Assets", "UnityPackages", "2.meta");
        }
コード例 #4
0
        private async Task Test_Recursive()
        {
            // Arrange

            foreach (var package in new[] { "DepA", "DepB", "DepC" })
            {
                PackTool.Process(new PackTool.Options
                {
                    ProjectFile     = TestHelper.GetDataPath(package + ".json"),
                    OutputDirectory = TestHelper.GetOutputPath()
                });
            }

            // Act

            var restorePath = TestHelper.CreateOutputPath("Restore");
            await RestoreTool.Process(new RestoreTool.Options
            {
                ProjectFile              = TestHelper.GetDataPath("DepD.json"),
                OutputDirectory          = restorePath,
                LocalRepositoryDirectory = TestHelper.GetOutputPath()
            });

            // Assert

            var basePath = Path.Combine(restorePath, "Assets", "UnityPackages");

            AssertFileExistsWithMeta(basePath, "DepA.unitypackage.json");
            AssertFileExistsWithMeta(basePath, "DepA", "FileA.txt");
            AssertFileExistsWithMeta(basePath, "DepB.unitypackage.json");
            AssertFileExistsWithMeta(basePath, "DepB", "FileB.txt");
            AssertFileExistsWithMeta(basePath, "DepC.unitypackage.json");
            AssertFileExistsWithMeta(basePath, "DepC", "FileC.txt");
        }
コード例 #5
0
        private async Task Test_SimpleWithExtra()
        {
            // Arrange

            PackTool.Process(new PackTool.Options
            {
                ProjectFile     = TestHelper.GetDataPath("Simple.json"),
                OutputDirectory = TestHelper.GetOutputPath()
            });

            // Act

            var restorePath = TestHelper.CreateOutputPath("Restore");
            await RestoreTool.Process(new RestoreTool.Options
            {
                ProjectFile              = TestHelper.GetDataPath("SimpleRestoreWithExtra.json"),
                OutputDirectory          = restorePath,
                LocalRepositoryDirectory = TestHelper.GetOutputPath()
            });

            // Assert

            var packagePath = Path.Combine(restorePath, "Assets", "UnityPackages", "Simple");

            AssertFileExistsWithMeta(packagePath, "../Simple.unitypackage.json");
            AssertFileExistsWithMeta(packagePath, "Text1.txt");
            AssertFileExistsWithMeta(packagePath, "Text2.txt");
            AssertFileExistsWithMeta(packagePath, "SubDir", "TextInSubDir.txt");

            AssertFileExists(restorePath, "Assets", "UnityPackages.meta");
            AssertFileExists(restorePath, "Assets", "UnityPackages", "Simple.meta");
            AssertFileExists(restorePath, "Assets", "UnityPackages", "Simple", "SubDir.meta");
        }
コード例 #6
0
        private async Task Test_Recursive_NearestWin_ConflictVersion()
        {
            // Arrange:
            // Project -> DepX 1.x -> DepY >=1.0
            //         -> DepY <=0.9
            // - Available DepY: 0.9, 1.0

            foreach (var package in new[] { "DepX.1.0.0", "DepY.0.9.0", "DepY.1.0.0" })
            {
                PackTool.Process(new PackTool.Options
                {
                    ProjectFile     = TestHelper.GetDataPath(package + ".json"),
                    OutputDirectory = TestHelper.GetOutputPath()
                });
            }

            // Act

            var restorePath = TestHelper.CreateOutputPath("Restore");
            var e           = await Record.ExceptionAsync(() =>
                                                          RestoreTool.Process(new RestoreTool.Options
            {
                ProjectFile              = TestHelper.GetDataPath("ProjectDepX_Y_Conflict.json"),
                OutputDirectory          = restorePath,
                LocalRepositoryDirectory = TestHelper.GetOutputPath()
            }));

            // Assert

            Assert.NotNull(e);
            Assert.IsType <InvalidDataException>(e);
        }
コード例 #7
0
        private async Task Test_Recursive_NearestWin()
        {
            // Arrange:
            // Project -> DepX 1.x -> DepY >=1.0
            //         -> DepY 1.x
            // - Available DepY: 1.0, 1.1

            foreach (var package in new[] { "DepX.1.0.0", "DepY.1.0.0", "DepY.1.1.0" })
            {
                PackTool.Process(new PackTool.Options
                {
                    ProjectFile     = TestHelper.GetDataPath(package + ".json"),
                    OutputDirectory = TestHelper.GetOutputPath()
                });
            }

            // Act

            var restorePath = TestHelper.CreateOutputPath("Restore");
            await RestoreTool.Process(new RestoreTool.Options
            {
                ProjectFile              = TestHelper.GetDataPath("ProjectDepX_Y.json"),
                OutputDirectory          = restorePath,
                LocalRepositoryDirectory = TestHelper.GetOutputPath()
            });

            // Assert

            var basePath = Path.Combine(restorePath, "Assets", "UnityPackages");

            AssertFileExistsWithMeta(basePath, "DepX.unitypackage.json");
            AssertFileExistsWithMeta(basePath, "DepX", "FileX.txt");
            AssertFileExistsWithMeta(basePath, "DepY.unitypackage.json");
            AssertFileExistsWithMeta(basePath, "DepY", "FileYv110.txt");
        }
コード例 #8
0
        private async Task Test_Floating()
        {
            // Arrange

            foreach (var package in new[] { "DepY.1.0.0", "DepY.1.1.0" })
            {
                PackTool.Process(new PackTool.Options
                {
                    ProjectFile     = TestHelper.GetDataPath(package + ".json"),
                    OutputDirectory = TestHelper.GetOutputPath()
                });
            }

            // Act

            var restorePath = TestHelper.CreateOutputPath("Restore");
            await RestoreTool.Process(new RestoreTool.Options
            {
                ProjectFile              = TestHelper.GetDataPath("ProjectDepY_Floating.json"),
                OutputDirectory          = restorePath,
                LocalRepositoryDirectory = TestHelper.GetOutputPath()
            });

            // Assert

            var basePath = Path.Combine(restorePath, "Assets", "UnityPackages");

            AssertFileExistsWithMeta(basePath, "DepY.unitypackage.json");
            AssertFileExistsWithMeta(basePath, "DepY", "FileYv110.txt");
        }
コード例 #9
0
ファイル: PackTest.cs プロジェクト: qipa/UniGet
        private void Test_InheritBaseProject()
        {
            // Act

            PackTool.Process(new PackTool.Options
            {
                ProjectFile     = TestHelper.GetDataPath("InheritChild.json"),
                OutputDirectory = TestHelper.GetOutputPath()
            });

            // Assert

            var unpackPath = TestHelper.CreateOutputPath("Unpack");

            Extracter.ExtractUnityPackage(TestHelper.GetOutputPath() + "/InheritChild.1.0.0.unitypackage", unpackPath, "InheritChild", true, true);

            var packagePath = Path.Combine(unpackPath, "Assets", "UnityPackages", "InheritChild");

            AssertFileExistsWithMeta(packagePath, "../InheritChild.unitypackage.json");
            AssertFileExistsWithMeta(packagePath, "Text1.txt");
            AssertFileExistsWithMeta(packagePath, "Text2.txt");
        }