示例#1
0
        public void TestReleaseVersionAndSquashUnreleased_ShouldThrowOnReleasedVersionsToBeSquashed()
        {
            DeleteVersionsIfExistent(c_jiraProjectKey, "6.0.1-alpha.1", "6.0.1-alpha.2", "6.0.1-beta.1");

            //Create versions mangled to verify they are ordered before squashed
            _service.CreateVersion(c_jiraProjectKey, "6.0.1-alpha.2", null);
            _service.CreateVersion(c_jiraProjectKey, "6.0.1-beta.1", null);
            _service.CreateVersion(c_jiraProjectKey, "6.0.1-alpha.1", null);

            var alpha1Version = _versionFinder.FindVersions(c_jiraProjectKey, "6.0.1-alpha.1").Single(x => x.name == "6.0.1-alpha.1");
            var alpha2Version = _versionFinder.FindVersions(c_jiraProjectKey, "6.0.1.alpha.2").Single(x => x.name == "6.0.1-alpha.2");
            var beta1Version  = _versionFinder.FindVersions(c_jiraProjectKey, "6.0.1-beta.1").Single(x => x.name == "6.0.1-beta.1");

            _service.ReleaseVersion(alpha2Version.id, beta1Version.id);

            Assert.That(
                () => { _service.ReleaseVersionAndSquashUnreleased(alpha1Version.id, beta1Version.id, c_jiraProjectKey); },
                Throws.Exception.TypeOf <JiraException>().With.Message.EqualTo(
                    "Version '" + alpha1Version.name + "' cannot be released, as there is already one or multiple released version(s) (" + alpha2Version.name
                    + ") before the next version '" + beta1Version.name + "'."));

            Assert.That(_versionFinder.FindVersions(c_jiraProjectKey, "6.0.1-alpha.2").SingleOrDefault(x => x.name == "6.0.1-alpha.2"), Is.Not.Null);

            DeleteVersionsIfExistent(c_jiraProjectKey, "6.0.1-alpha.1", "6.0.1-alpha.2", "6.0.1-beta.1");
        }
        public override bool Execute()
        {
            try
            {
                JiraRestClient             restClient = new JiraRestClient(JiraUrl, Authenticator);
                IJiraProjectVersionService service    = new JiraProjectVersionService(restClient);
                service.ReleaseVersionAndSquashUnreleased(VersionID, NextVersionID, ProjectKey);

                return(true);
            }
            catch (Exception ex)
            {
                Log.LogErrorFromException(ex);
                return(false);
            }
        }
        public override bool Execute()
        {
            try
              {
            JiraRestClient restClient = new JiraRestClient (JiraUrl, Authenticator);
            IJiraProjectVersionService service = new JiraProjectVersionService (restClient);
            service.ReleaseVersionAndSquashUnreleased(VersionID, NextVersionID, ProjectKey);

            return true;
              }
              catch (Exception ex)
              {
            Log.LogErrorFromException (ex);
            return false;
              }
        }