public void Initialize()
        {
            Console.WriteLine("");
            Console.WriteLine("Preparing test source project and package to install from...");
            Console.WriteLine("");
            Console.WriteLine("Original directory:");
            Console.WriteLine("  " + TestSourceDirectory);
            Console.WriteLine("");

            Console.WriteLine("Source project directory:");
            Console.WriteLine("  " + TestSourceDirectory);
            Console.WriteLine("");

            if (CloneSource)
            {
                new Gitter().Clone(OriginalDirectory, TestSourceDirectory);
            }

            if (GrabOriginalFiles)
            {
                new FilesGrabber(
                    OriginalDirectory,
                    TestSourceDirectory
                    ).GrabOriginalFiles();
            }

            var nodes = new ProjectNodeManager(TestSourceDirectory);

            // Refresh the nodes to pick up the status
            nodes.Refresh();

            nodes.CurrentNode.Properties["Version"] = "1.0.0.0";
            nodes.CurrentNode.Save();

            // TODO: Remove if not needed
            //Status = GetStatus();

            if (Build)
            {
                var buildMode = "Release";

            #if DEBUG
                buildMode = "Debug";
            #endif

                var solutions = nodes.CurrentNode.Properties ["CycleBuildSolutions"];

                new SolutionBuilder(buildMode).BuildAllSolutions(TestSourceDirectory);
            }

            if (CreatePackages)
            {
                ClearProjectPackages();

                PrepareProjectPackages();
            }
        }
        public override void Construct(string scriptName, IScript parentScript)
        {
            if (Script.IsVerbose)
            {
                Console.WriteLine("");
                Console.WriteLine("--------------------------------------------------");
                Console.WriteLine("");
                Console.WriteLine("Constructing '" + scriptName + "' script...");
                Console.WriteLine("Script type: '" + Script.GetType().Name + "'");
                Console.WriteLine("Component: " + GetType().Name);
                Console.WriteLine("");
            }

            base.Construct(scriptName, parentScript);

            var script = (BaseProjectTestScript)Script;

            script.TestSummarizer = new TestSummarizer(script);

            script.SetUpper = new ProjectTestScriptSetUpper(script);

            script.TearDowner = new ProjectTestScriptTearDowner(script);

            var nodeManager = new ProjectNodeManager();

            if (parentScript != null)
            {
                nodeManager.CurrentNode = parentScript.Nodes.CurrentNode;
            }
            script.InitializeNodeManager(nodeManager);

            script.InitializeVersionManager(new VersionManager(nodeManager.CurrentNode));

            if (Script.IsVerbose)
            {
                Console.WriteLine("");
                Console.WriteLine("--------------------------------------------------");
                Console.WriteLine("");
            }
        }
 public BaseLiveProjectTestScript()
 {
     Nodes = new ProjectNodeManager();
 }
Exemplo n.º 4
0
 public override void Construct()
 {
     Nodes = new ProjectNodeManager();
 }
Exemplo n.º 5
0
        public string PrepareSpecifyStatus(string setupFileName, string buildMode)
        {
            // Grab all the original files
            new FilesGrabber(
                OriginalDirectory,
                WorkingDirectory
                ).GrabOriginalFiles();

            var nodeManager = new ProjectNodeManager(WorkingDirectory);

            nodeManager.IncludeChildNodes = true;
            nodeManager.EnsureNodes();

            var currentNode = nodeManager.State.CurrentNode;

            // Set the status to beta
            currentNode.Properties["Status"]  = "beta";
            currentNode.Properties["Version"] = "1.0.0.0";
            currentNode.Save();

            // Build the solution
            new SolutionBuilder(buildMode).BuildSolution("csAnt.Tests");

            // Repack the csAnt-SetUp.exe file to include dependencies
            new SetUpRepacker(buildMode).Repack();

            new FileCopier(
                Path.Combine(WorkingDirectory, "bin/" + BuildMode.Value + "/packed"),
                WorkingDirectory
                ).Copy("*");

            // Create the package
            new NugetPacker()
            {
                Status  = currentNode.Properties["Status"],
                Version = new Version(currentNode.Properties["Version"])
            }.Pack(CurrentDirectory, "csAnt");

            new VersionManager().IncrementVersion(currentNode, 2);

            // Reset the status back to alpha
            currentNode.Properties["Status"] = "alpha";
            currentNode.Save();

            // Repackage
            new NugetPacker()
            {
                Status  = currentNode.Properties["Status"],
                Version = new Version(currentNode.Properties["Version"])
            }.Pack(CurrentDirectory, "csAnt");

            // Create a test project directory
            var testProjectDirectory = CreateTestProjectPath();

            var workingBinDirectory = WorkingDirectory
                                      + Path.DirectorySeparatorChar
                                      + "bin"
                                      + Path.DirectorySeparatorChar
                                      + buildMode
                                      + Path.DirectorySeparatorChar
                                      + "packed";

            DirectoryChecker.EnsureDirectoryExists(testProjectDirectory);

            // Copy setup file to test project directory, ready to run
            new FilesGrabber(
                workingBinDirectory,
                testProjectDirectory
                ).GrabOriginalFiles(
                setupFileName
                );

            CreateMockFeed();

            // Create the path to a local copy of nuget.exe (so it doesn't get downloaded from the web)
            LocalNugetFilePath = WorkingDirectory
                                 + Path.DirectorySeparatorChar
                                 + "lib"
                                 + Path.DirectorySeparatorChar
                                 + "nuget.exe";

            return(testProjectDirectory);
        }
Exemplo n.º 6
0
 public BaseProjectsIntegrationTestFixture()
 {
     Nodes = new ProjectNodeManager();
 }