Ejemplo n.º 1
0
        public void MakeAddCommandTest()
        {
            String fullPath = null;

            Directory.CreateDirectory(settings.Config.LocalPath);
            Environment.CurrentDirectory = settings.Config.LocalPath;
            // add file TargetFile
            // commit file TargetFile
            // remove file TargetFile
            // commit remove TargetFile
            String[] files = Directory.GetFiles(Path.Combine(Environment.CurrentDirectory,
                                                             settings.Config.Module), settings.Config.TargetFile);
            Assert.IsTrue(files.Length > 0);

            foreach (String file in files)
            {
                LOGGER.Debug("file=[" + file + "]");
                // Remove the .txt when everything works, giving me bugs...
                String newFileName = Guid.NewGuid().ToString() + ".txt";
                fullPath = Path.Combine(Path.Combine(Environment.CurrentDirectory, settings.Config.Module), newFileName);
                File.Copy(file, fullPath);
            }
            String commandLine = "-d" + settings.Config.Cvsroot + " add " + fullPath;

            String [] commandLineArgs = commandLine.Split(' ');
            // Create consoleMain object to test the Add command
            ConsoleMain consoleMain = new ConsoleMain();

            Assert.IsNotNull(consoleMain);

            consoleMain.Execute(commandLineArgs);
            Assert.IsTrue(File.Exists(fullPath));
        }
Ejemplo n.º 2
0
        public void MakeMainTest()
        {
            // Test Creating a ConsoleMain object
            ConsoleMain newMain = new ConsoleMain();

            String[] args = { "--help" };

            // Execute the Execute method
            newMain.Execute(args);
        }
Ejemplo n.º 3
0
        public void HelpCommandTest()
        {
            // Test Creating a ConsoleMain object
            ConsoleMain newMain = new ConsoleMain();

            String[] args = { "--help-commands" };

            // Execute the Execute method
            newMain.Execute(args);
        }
Ejemplo n.º 4
0
        public void MinusdOptionCheckoutFileIntoDir()
        {
            String commandLine = "-d" + settings.Config.Cvsroot + " co -d newlocation " + settings.Config.Module;

            String [] commandLineArgs = commandLine.Split(' ');
            // Test Creating a ConsoleMain object
            ConsoleMain consoleMain = new ConsoleMain();

            Assert.IsNotNull(consoleMain);
            consoleMain.Execute(commandLineArgs);
            Assert.IsTrue(Directory.Exists(Path.Combine(settings.Config.LocalPath, "newlocation")));
        }
Ejemplo n.º 5
0
        public void MakeInitCommandTest()
        {
            Directory.CreateDirectory(settings.Config.LocalPath);
            Environment.CurrentDirectory = settings.Config.LocalPath;
            String commandLine = "-d" + settings.Config.Cvsroot + " init";

            String [] commandLineArgs = commandLine.Split(' ');
            // Create a consoleMain to test the InitCommand
            ConsoleMain consoleMain = new ConsoleMain();

            Assert.IsNotNull(consoleMain);
            consoleMain.Execute(commandLineArgs);
        }
Ejemplo n.º 6
0
        public void MinusrOptionCheckoutFilesBasedOnRevision()
        {
            String commandLine = "-d" + settings.Config.Cvsroot + " co -r " + settings.Config.Tag1 +
                                 " " + settings.Config.Module;

            String [] commandLineArgs = commandLine.Split(' ');
            // Test Creating a ConsoleMain object
            ConsoleMain consoleMain = new ConsoleMain();

            consoleMain.Execute(commandLineArgs);
            // check for directory
            Assert.IsTrue(Directory.Exists(Path.Combine(settings.Config.LocalPath, settings.Config.Module)));
            // check for files with specified revision
        }
Ejemplo n.º 7
0
        public void MakeUpdateCommandTest()
        {
            Directory.CreateDirectory(settings.Config.LocalPath);
            Environment.CurrentDirectory = settings.Config.LocalPath;

            String commandLine = "-d" + settings.Config.Cvsroot + " up " +
                                 Path.Combine(settings.Config.LocalPath, settings.Config.TargetFile);

            String [] commandLineArgs = commandLine.Split(' ');
            // Test Creating a consoleMain object to test the UpdateCommand object
            ConsoleMain consoleMain = new ConsoleMain();

            consoleMain.Execute(commandLineArgs);
            Assert.IsNotNull(consoleMain);
        }
Ejemplo n.º 8
0
        public void MinusdOptionUpdateFileIntoDir()
        {
            Directory.CreateDirectory(settings.Config.LocalPath);
            Environment.CurrentDirectory = settings.Config.LocalPath;
            String commandLine = "-d" + settings.Config.Cvsroot + " up -d newlocation " +
                                 Path.Combine(settings.Config.LocalPath, settings.Config.TargetFile);

            String [] commandLineArgs = commandLine.Split(' ');
            // Test Creating a ConsoleMain object to test the UpdateCommand object
            ConsoleMain consoleMain = new ConsoleMain();

            Assert.IsNotNull(consoleMain);
            consoleMain.Execute(commandLineArgs);
            Assert.IsTrue(Directory.Exists(Path.Combine(settings.Config.LocalPath, "newlocation")));
        }
Ejemplo n.º 9
0
        public void MinusrOptionRTagFilesBasedOnRevision()
        {
            Directory.CreateDirectory(settings.Config.LocalPath);
            Environment.CurrentDirectory = settings.Config.LocalPath;

            String commandLine = "-d" + settings.Config.Cvsroot + " rt -r " +
                                 settings.Config.Tag1 + " " + settings.Config.Module;

            String [] commandLineArgs = commandLine.Split(' ');
            // Test Create the consoleMain to test the console RTagCommand
            ConsoleMain consoleMain = new ConsoleMain();

            consoleMain.Execute(commandLineArgs);
            Assert.IsNotNull(consoleMain);
        }
Ejemplo n.º 10
0
        public void MakeCheckoutCommandTest()
        {
            Directory.CreateDirectory(settings.Config.LocalPath);
            Environment.CurrentDirectory = settings.Config.LocalPath;

            String commandLine =
                "-d" + settings.Config.Cvsroot + " co " + settings.Config.Module;

            String [] commandLineArgs = commandLine.Split(' ');
            // Test Creating a ConsoleMain object
            ConsoleMain consoleMain = new ConsoleMain();

            consoleMain.Execute(commandLineArgs);
            Assert.IsTrue(Directory.Exists(Path.Combine(settings.Config.LocalPath, settings.Config.Module)));
        }
Ejemplo n.º 11
0
        public void MinusrOptionCommitFilesBasedOnRevision()
        {
            Directory.CreateDirectory(settings.Config.LocalPath);
            Environment.CurrentDirectory = settings.Config.LocalPath;

            String commandLine =
                "-d" + settings.Config.Cvsroot + " ci -r " + settings.Config.Tag1 +
                " " + Path.Combine(settings.Config.LocalPath, settings.Config.TargetFile);

            String [] commandLineArgs = commandLine.Split(' ');
            // Test Creating a CommitCommand object
            ConsoleMain consoleMain = new ConsoleMain();

            consoleMain.Execute(commandLineArgs);
        }
Ejemplo n.º 12
0
        public void MinusDOptionRTagByCertainDate()
        {
            Directory.CreateDirectory(settings.Config.LocalPath);
            Environment.CurrentDirectory = settings.Config.LocalPath;

            String commandLine = "-d" + settings.Config.Cvsroot + " rt -D " +
                                 Path.Combine(settings.Config.LocalPath, settings.Config.TargetFile) +
                                 " " + settings.Config.Module;

            String [] commandLineArgs = commandLine.Split(' ');
            // Test Create the consoleMain to test the console RTagCommand
            ConsoleMain consoleMain = new ConsoleMain();

            consoleMain.Execute(commandLineArgs);
            Assert.IsNotNull(consoleMain);
        }
Ejemplo n.º 13
0
        public void MakeCommitCommandTest()
        {
            Directory.CreateDirectory(settings.Config.LocalPath);
            Environment.CurrentDirectory = settings.Config.LocalPath;

            String commandLine =
                "-d" + settings.Config.Cvsroot + " ci " +
                Path.Combine(settings.Config.LocalPath, settings.Config.TargetFile);

            String [] commandLineArgs = commandLine.Split(' ');
            // Test Creating a CommitCommand object
            ConsoleMain consoleMain = new ConsoleMain();

            consoleMain.Execute(commandLineArgs);
            //Assertion.Assert (Directory.Exists(Path.Combine(settings.Config.LocalPath, settings.Config.TargetFile)));
        }
Ejemplo n.º 14
0
        public void MinusDOptionCommitFilesWithMsg()
        {
            Directory.CreateDirectory(settings.Config.LocalPath);
            Environment.CurrentDirectory = settings.Config.LocalPath;

            String commandLine =
                "-d" + settings.Config.Cvsroot + " ci -m thismessage " +
                Path.Combine(settings.Config.LocalPath, settings.Config.TargetFile);

            String [] commandLineArgs = commandLine.Split(' ');
            // Test Creating a CommitCommand object
            ConsoleMain consoleMain = new ConsoleMain();

            consoleMain.Execute(commandLineArgs);
            // Verify file with new message text
            //Assertion.Assert ("Should have found the check file.  file=[" +
            //    checkFile + "]", File.Exists (checkFile));
        }
Ejemplo n.º 15
0
        public void MinusDOptionCheckoutByCertainDate()
        {
            String commandLine = "-d" + settings.Config.Cvsroot + " co -D 09.13.03 " + settings.Config.Module;

            String [] commandLineArgs = commandLine.Split(' ');
            // Test Creating a ConsoleMain object
            ConsoleMain consoleMain = new ConsoleMain();

            Assert.IsNotNull(consoleMain);
            consoleMain.Execute(commandLineArgs);
            Assert.IsTrue(Directory.Exists(Path.Combine(settings.Config.LocalPath, settings.Config.Module)));
            // Find a file that should exist
            //Assertion.Assert ("Should have found the check file.  file=[" +
            //    checkFile + "]", File.Exists (checkFile));

            // Find a file that should not exist
            //Assertion.Assert ("Should have found the check file.  file=[" +
            //    checkFile + "]", File.Exists (checkFile));
        }
Ejemplo n.º 16
0
        public void MakeRemoveCommandTest()
        {
            Directory.CreateDirectory(settings.Config.LocalPath);
            Environment.CurrentDirectory = settings.Config.LocalPath;
            // add file TargetFile
            // commit file TargetFile
            // remove file TargetFile
            // commit remove TargetFile
            String commandLine = "-d" + settings.Config.Cvsroot + " rm " +
                                 Path.Combine(settings.Config.LocalPath, settings.Config.TargetFile);

            String [] commandLineArgs = commandLine.Split(' ');
            // Test Creating a RemoveCommand object
            ConsoleMain consoleMain = new ConsoleMain();

            Assert.IsNotNull(consoleMain);

            consoleMain.Execute(commandLineArgs);
            Assert.IsTrue(!File.Exists(Path.Combine(settings.Config.LocalPath, settings.Config.TargetFile)));
        }
Ejemplo n.º 17
0
        public void MinusDOptionUpdateByCertainDate()
        {
            Directory.CreateDirectory(settings.Config.LocalPath);
            Environment.CurrentDirectory = settings.Config.LocalPath;
            String commandLine = "-d" + settings.Config.Cvsroot + " up -D 01.28.03 " +
                                 Path.Combine(settings.Config.LocalPath, settings.Config.TargetFile);

            String [] commandLineArgs = commandLine.Split(' ');

            // Test Creating a ConsoleMain object to test the UpdateCommand object
            ConsoleMain consoleMain = new ConsoleMain();

            Assert.IsNotNull(consoleMain);
            consoleMain.Execute(commandLineArgs);
            // Find a file that should exist
            //Assertion.Assert ("Should have found the update file.  file=[" +
            //    checkFile + "]", File.Exists (checkFile));

            // Find a file that should not exist
            //Assertion.Assert ("Should have found the update file.  file=[" +
            //    checkFile + "]", File.Exists (checkFile));
        }
Ejemplo n.º 18
0
        public void TestBug884798_OneSpace()
        {
            Environment.CurrentDirectory = this.GetTempPath();
            String commandLine =
                "-d:pserver:[email protected]:/home/cvs/src co -d sharpcvslib-new -r HEAD sharpcvslib-test-repository";
            // Create new process

            ConsoleMain main = new ConsoleMain();

            try {
                main.Execute(commandLine.Split(' '));
            } catch (Exception e) {
                LOGGER.Error(e);
                Assert.Fail(e.ToString());
            }
            Manager manager = new Manager(this.GetTempPath());
            String  modDir  = Path.Combine(this.GetTempPath(), this.settings.Config.Module);
            Tag     tag     = manager.FetchTag(Path.Combine(modDir, "src"));

            Assert.IsNotNull(tag);
            Assert.AreEqual("NHEAD", tag.FileContents);
        }