Exemple #1
0
        public void TagTraces_VerifySuccess()
        {
            string json = @"{
                            ""success"": true,
                            ""messages"": [
                                ""Tag successful""
                            ]
                        }";
            TagsServersResource request = new TagsServersResource();

            request.TracesId = new List <string> {
                "traceId1", "traceId2"
            };
            request.Tags = new List <string> {
                "testTag", "anotherTag"
            };

            var mockSdkHttpClient = new Mock <IContrastRestClient>();

            mockSdkHttpClient.Setup(client => client.PutMessage("api/ng/orgId/tags/traces", JsonConvert.SerializeObject(request), null)).Returns(
                PostUtil.GetPostResponse(System.Net.HttpStatusCode.OK, json)
                );
            var teamServerClient = new TeamServerClient(mockSdkHttpClient.Object);
            var response         = teamServerClient.TagTraces("orgId", request);

            Assert.IsTrue(response.Success);
        }
        /// <summary>
        /// Tag traces.
        /// </summary>
        /// <param name="organizationId">Organization UUID.</param>
        /// <param name="requestBody">A TagsServerResource object with a list of tags and the traces to be tagged.</param>
        /// <returns>A base response to indicate success of the operation.</returns>
        public BaseApiResponse TagTraces(string organizationId, TagsServersResource requestBody)
        {
            string endpoint = String.Format(NgEndpoints.TRACES_TAGS, organizationId);

            return(GetResponseAndDeserialize <BaseApiResponse>(endpoint, JsonConvert.SerializeObject(requestBody), RequestMethod.Put));
        }