Esempio n. 1
0
        public void PushAllWithUrlTest()
        {
            // Prepare
            const string url = "ssh://[email protected]:xforever1313/svn2gitnetx.git";

            Mock <ICommandRunner> mockCmdRunner = new Mock <ICommandRunner>(MockBehavior.Strict);

            Options options = new Options
            {
                PushWhenDone = true,
                RemoteGitUrl = url
            };

            GitPusher uut = new GitPusher(options, mockCmdRunner.Object, null, null);

            mockCmdRunner.Setup(
                m => m.Run("git", $"push --all \"{url}\"")
                ).Returns(0);

            // Act
            uut.PushAll();

            // Assert
            mockCmdRunner.VerifyAll();
        }
Esempio n. 2
0
        public void PushPruneWithUrlTest()
        {
            // Prepare
            const string url = "ssh://[email protected]:xforever1313/svn2gitnetx.git";

            Mock <ICommandRunner> mockCmdRunner = new Mock <ICommandRunner>(MockBehavior.Strict);

            Options options = new Options
            {
                StaleSvnBranchPurgeOption = StaleSvnBranchPurgeOptions.delete_local_and_remote,
                RemoteGitUrl = url
            };

            GitPusher uut = new GitPusher(options, mockCmdRunner.Object, null, null);

            mockCmdRunner.Setup(
                m => m.Run("git", $"push --prune \"{url}\"")
                ).Returns(0);

            // Act
            uut.PushPrune();

            // Assert
            mockCmdRunner.VerifyAll();
        }
Esempio n. 3
0
        public void PushPruneNoUrlTest()
        {
            // Prepare
            Mock <ICommandRunner> mockCmdRunner = new Mock <ICommandRunner>(MockBehavior.Strict);

            Options options = new Options
            {
                StaleSvnBranchPurgeOption = StaleSvnBranchPurgeOptions.delete_local_and_remote
            };

            GitPusher uut = new GitPusher(options, mockCmdRunner.Object, null, null);

            mockCmdRunner.Setup(
                m => m.Run("git", "push --prune")
                ).Returns(0);

            // Act
            uut.PushPrune();

            // Assert
            mockCmdRunner.VerifyAll();
        }
Esempio n. 4
0
        public void PushAllFailureTest()
        {
            // Prepare
            Mock <ICommandRunner> mockCmdRunner = new Mock <ICommandRunner>(MockBehavior.Strict);

            Options options = new Options
            {
                PushWhenDone = true
            };

            GitPusher uut = new GitPusher(options, mockCmdRunner.Object, null, null);

            mockCmdRunner.Setup(
                m => m.Run("git", "push --all")
                ).Returns(1); // Non-zero, should get an exception.

            // Act
            Assert.Throws <ApplicationException>(() => uut.PushAll());

            // Assert
            mockCmdRunner.VerifyAll();
        }
Esempio n. 5
0
        public void PushPruneFailureTest()
        {
            // Prepare
            Mock <ICommandRunner> mockCmdRunner = new Mock <ICommandRunner>(MockBehavior.Strict);

            Options options = new Options
            {
                StaleSvnBranchPurgeOption = StaleSvnBranchPurgeOptions.delete_local_and_remote
            };

            GitPusher uut = new GitPusher(options, mockCmdRunner.Object, null, null);

            mockCmdRunner.Setup(
                m => m.Run("git", "push --prune")
                ).Returns(1); // Non-zero, should get an exception.

            // Act
            Assert.Throws <ApplicationException>(() => uut.PushPrune());

            // Assert
            mockCmdRunner.VerifyAll();
        }
Esempio n. 6
0
        public void PushAllNoUrlTest()
        {
            // Prepare
            Mock <ICommandRunner> mockCmdRunner = new Mock <ICommandRunner>(MockBehavior.Strict);

            Options options = new Options
            {
                PushWhenDone = true
            };

            GitPusher uut = new GitPusher(options, mockCmdRunner.Object, null, null);

            mockCmdRunner.Setup(
                m => m.Run("git", "push --all")
                ).Returns(0);

            // Act
            uut.PushAll();

            // Assert
            mockCmdRunner.VerifyAll();
        }