Beispiel #1
0
        /// <summary>
        /// Gets the external links.
        /// </summary>
        /// <param name="projectName">Name of the project.</param>
        /// <returns></returns>
        /// <remarks></remarks>
        public ExternalLink[] GetExternalLinks(string projectName)
        {
            ExternalLinksListResponse resp = cruiseServer.GetExternalLinks(GenerateProjectRequest(projectName));

            ValidateResponse(resp);
            return(resp.ExternalLinks.ToArray());
        }
        /// <summary>
        /// Retrieves any external links.
        /// </summary>
        /// <param name="projectName">The name of the project to use.</param>
        /// <returns></returns>
        public override ExternalLink[] GetExternalLinks(string projectName)
        {
            ExternalLinksListResponse resp = ValidateResponse(
                connection.SendMessage("GetExternalLinks", GenerateProjectRequest(projectName)))
                                             as ExternalLinksListResponse;

            return(resp.ExternalLinks.ToArray());
        }
Beispiel #3
0
        public void InitialiseResponseFromRequestSetsTheDefaultValues()
        {
            DateTime                  now      = DateTime.Now;
            ServerRequest             request  = new ServerRequest();
            ExternalLinksListResponse response = new ExternalLinksListResponse(request);

            Assert.AreEqual(ResponseResult.Unknown, response.Result, "Result wasn't set to failure");
            Assert.AreEqual(request.Identifier, response.RequestIdentifier, "RequestIdentifier wasn't set to the identifier of the request");
            Assert.IsTrue((now <= response.Timestamp), "Timestamp was not set");
        }
Beispiel #4
0
        public void GetExternalLinks()
        {
            ExternalLinksListResponse response = new ExternalLinksListResponse();

            response.Result = ResponseResult.Success;
            CruiseServerClient client = new CruiseServerClient(
                new ServerStub("GetExternalLinks", typeof(ProjectRequest), "Project #1", response));

            client.GetExternalLinks("Project #1");
        }
Beispiel #5
0
        public void ToStringSerialisesDefaultValues()
        {
            ExternalLinksListResponse response = new ExternalLinksListResponse();
            string actual   = response.ToString();
            string expected = string.Format(System.Globalization.CultureInfo.CurrentCulture, "<externalLinksResponse xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " +
                                            "timestamp=\"{1:yyyy-MM-ddTHH:mm:ss.FFFFFFFzzz}\" result=\"{0}\" />",
                                            response.Result,
                                            response.Timestamp);

            Assert.AreEqual(expected, actual);
        }
Beispiel #6
0
        public void InitialiseNewResponseSetsTheDefaultValues()
        {
            DateTime now = DateTime.Now;
            ExternalLinksListResponse response = new ExternalLinksListResponse();

            Assert.AreEqual(ResponseResult.Unknown, response.Result, "Result wasn't set to failure");
            Assert.IsTrue((now <= response.Timestamp), "Timestamp was not set");
            var links = new List <ExternalLink>();

            response.ExternalLinks = links;
            Assert.AreSame(links, response.ExternalLinks);
        }
Beispiel #7
0
        public void InitialiseResponseFromResponseSetsTheDefaultValues()
        {
            DateTime now = DateTime.Now;
            ExternalLinksListResponse response1 = new ExternalLinksListResponse();

            response1.Result            = ResponseResult.Success;
            response1.RequestIdentifier = "original id";
            response1.Timestamp         = DateTime.Now.AddMinutes(-1);
            ExternalLinksListResponse response2 = new ExternalLinksListResponse(response1);

            Assert.AreEqual(ResponseResult.Success, response2.Result, "Result wasn't set to failure");
            Assert.AreEqual("original id", response2.RequestIdentifier, "RequestIdentifier wasn't set to the identifier of the request");
            Assert.IsTrue((response1.Timestamp == response2.Timestamp), "Timestamp was not set");
        }
Beispiel #8
0
        public void ToStringSerialisesAllValues()
        {
            ExternalLinksListResponse response = new ExternalLinksListResponse();

            response.ErrorMessages.Add(new ErrorMessage("Error 1"));
            response.ErrorMessages.Add(new ErrorMessage("Error 2"));
            response.RequestIdentifier = "request";
            response.Result            = ResponseResult.Success;
            response.Timestamp         = DateTime.Now;
            response.ExternalLinks.Add(new ExternalLink("link name", "link url"));
            string actual   = response.ToString();
            string expected = string.Format(System.Globalization.CultureInfo.CurrentCulture, "<externalLinksResponse xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " +
                                            "timestamp=\"{2:yyyy-MM-ddTHH:mm:ss.FFFFFFFzzz}\" identifier=\"{0}\" result=\"{1}\">" +
                                            "<error>Error 1</error>" +
                                            "<error>Error 2</error>" +
                                            "<link name=\"link name\" url=\"link url\" />" +
                                            "</externalLinksResponse>",
                                            response.RequestIdentifier,
                                            response.Result,
                                            response.Timestamp);

            Assert.AreEqual(expected, actual);
        }