Ejemplo n.º 1
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();
        }
Ejemplo n.º 2
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();
        }
Ejemplo n.º 3
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();
        }