Beispiel #1
0
        public void Tag_operation_not_supported()
        {
            var args = new GitCreateTagArgs(TagName, Revision, (TagOperation)10);
            var cmd  = new GitCreateTagCmd(args, _tagMessageFile);

            cmd.ToLine();
        }
        public void ToLine_should_throw_if_operation_not_supported()
        {
            var args = new GitCreateTagArgs(TagName, Revision, (TagOperation)10);
            var cmd  = new GitCreateTagCmd(args, TagMessageFile);

            Assert.Throws <NotSupportedException>(() => cmd.ToLine());
        }
Beispiel #3
0
        public void Tag_supported_operation(TagOperation operation)
        {
            var args = new GitCreateTagArgs(TagName, Revision, operation, signKeyId: KeyId, force: true);
            var cmd  = new GitCreateTagCmd(args, _tagMessageFile);

            var actualCmdLine = cmd.ToLine();

            var switches = "";

            switch (operation)
            {
            case TagOperation.Lightweight:
                break;

            case TagOperation.Annotate:
                switches = $" -a -F \"{_tagMessageFile}\"";
                break;

            case TagOperation.SignWithDefaultKey:
                switches = $" -s -F \"{_tagMessageFile}\"";
                break;

            case TagOperation.SignWithSpecificKey:
                switches = $" -u {KeyId} -F \"{_tagMessageFile}\"";
                break;
            }

            var expectedCmdLine = $"tag -f{switches} \"{TagName}\" -- \"{Revision}\"";

            Assert.AreEqual(expectedCmdLine, actualCmdLine);
        }
Beispiel #4
0
        public void Tag_supported_operation(TagOperation operation)
        {
            GitCreateTagCmd cmd = CreateDefaultCommand();

            cmd.Args.OperationType = operation;
            cmd.Args.Force         = true;

            string actualCmdLine = cmd.ToLine();

            string switches = "";

            switch (operation)
            {
            case TagOperation.Lightweight:
                break;

            case TagOperation.Annotate:
                switches = $" -a -F \"{Path.Combine(WorkingDir, "TAGMESSAGE")}\"";
                break;

            case TagOperation.SignWithDefaultKey:
                switches = $" -s -F \"{Path.Combine(WorkingDir, "TAGMESSAGE")}\"";
                break;

            case TagOperation.SignWithSpecificKey:
                switches = $" -u {KeyId} -F \"{Path.Combine(WorkingDir, "TAGMESSAGE")}\"";
                break;
            }

            string expectedCmdLine = $"tag -f{switches} \"{TagName}\" -- \"{Revision}\"";

            Assert.AreEqual(expectedCmdLine, actualCmdLine);
        }
Beispiel #5
0
        public void Tag_operation_not_supported()
        {
            GitCreateTagCmd cmd = CreateDefaultCommand();

            cmd.Args.OperationType = (TagOperation)10;

            cmd.ToLine();
        }
        public void ToLine_should_render_different_operations(TagOperation operation, string expected)
        {
            var args = new GitCreateTagArgs(TagName, Revision, operation, signKeyId: KeyId, force: true);
            var cmd  = new GitCreateTagCmd(args, TagMessageFile);

            var actualCmdLine = cmd.ToLine();

            Assert.AreEqual(expected, actualCmdLine);
        }
        public void ToLine_should_render_force_flag(bool force, string expected)
        {
            var args = new GitCreateTagArgs(TagName, Revision, TagOperation.SignWithDefaultKey, TagMessage, KeyId, force);
            var cmd  = new GitCreateTagCmd(args, TagMessageFile);

            var cmdLine = cmd.ToLine();

            Assert.AreEqual(expected, cmdLine);
        }
Beispiel #8
0
        public void Tag_sign_with_default_gpg(bool force)
        {
            var args = new GitCreateTagArgs(TagName, Revision, TagOperation.SignWithDefaultKey, TagMessage, KeyId, force);
            var cmd  = new GitCreateTagCmd(args, _tagMessageFile);

            var cmdLine = cmd.ToLine();

            var expectedCmdLine = $"tag{(force ? " -f" : "")} -s -F \"{_tagMessageFile}\" \"{TagName}\" -- \"{Revision}\"";

            Assert.AreEqual(expectedCmdLine, cmdLine);
        }
Beispiel #9
0
        public void Tag_sign_with_default_gpg(bool force)
        {
            GitCreateTagCmd cmd = CreateDefaultCommand();

            cmd.Args.Force         = force;
            cmd.Args.OperationType = TagOperation.SignWithDefaultKey;

            string cmdLine = cmd.ToLine();

            string expectedCmdLine = $"tag{(force ? " -f" : "")} -s -F \"{Path.Combine(WorkingDir, "TAGMESSAGE")}\" \"{TagName}\" -- \"{Revision}\"";

            Assert.AreEqual(expectedCmdLine, cmdLine);
        }