Exemple #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();
        }
Exemple #2
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();
        }
Exemple #3
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();
        }