public void Api_RestClientWrapper_GetRestRequest_ReturnsCorrectRequestWithCorrectFormat(RestClientParameters restClientParameters,
                                                                                                string expectedFormat)
        {
            var restClientWrapper = new RestClientWrapper(new RestClientWrapperCredentials());
            var result            = restClientWrapper.GetRestRequest(restClientParameters);

            Assert.AreEqual(expectedFormat.ToLower(), result.RequestFormat.ToString().ToLower());
        }
        public void Api_RestClientWrapper_GetRestRequest_ReturnsCorrectRequestWithCorrectUrl()
        {
            var restClientParameters = new RestClientParameters {
                RequestUrl = "v1/attributes/standard",
            };
            var restClientWrapper = new RestClientWrapper(new RestClientWrapperCredentials());
            var result            = restClientWrapper.GetRestRequest(restClientParameters);

            Assert.AreEqual(restClientParameters.RequestUrl, result.Resource);
        }
        public void Api_RestClientWrapper_GetRestRequest_ReturnsCorrectRequestWithCorrectBody(
            RestClientParameters restClientParameters, string expectedBodyType)
        {
            var restClientWrapper = new RestClientWrapper(new RestClientWrapperCredentials());
            var result            = restClientWrapper.GetRestRequest(restClientParameters);

            var body = result.Parameters.Where(x => x.Type == ParameterType.RequestBody);
            var expectedBodyCount = restClientParameters.RequestBody != null ? 1 : 0;

            Assert.AreEqual(expectedBodyCount, body.Count());
            Assert.AreEqual(expectedBodyType, body.FirstOrDefault()?.Name);
        }
        public void Api_RestClientWrapper_GetRestRequest_ReturnsCorrectRequestWithCorrectQueryParams(RestClientParameters restClientParameters)
        {
            var restClientWrapper = new RestClientWrapper(new RestClientWrapperCredentials());
            var result            = restClientWrapper.GetRestRequest(restClientParameters);

            var queryParams = result.Parameters.Where(x => x.Type == ParameterType.QueryString);
            var expectedQueryParamsCount = restClientParameters.RequestQueryParameters?.Count ?? 0;

            Assert.AreEqual(expectedQueryParamsCount, queryParams.Count());
            foreach (var param in queryParams)
            {
                Assert.IsTrue(restClientParameters.RequestQueryParameters.Keys.Contains(param.Name));
                Assert.AreEqual(restClientParameters.RequestQueryParameters[param.Name], param.Value);
            }
        }
        public void Api_RestClientWrapper_GetRestRequest_ReturnsCorrectRequestWithCorrectUrlSegments(RestClientParameters restClientParameters)
        {
            var restClientWrapper = new RestClientWrapper(new RestClientWrapperCredentials());
            var result            = restClientWrapper.GetRestRequest(restClientParameters);

            var urlSegments         = result.Parameters.Where(x => x.Type == ParameterType.UrlSegment);
            var expectedParamsCount = restClientParameters.RequestUrlSegments?.Count ?? 0;

            Assert.AreEqual(expectedParamsCount, urlSegments.Count());
            foreach (var urlSegment in urlSegments)
            {
                Assert.IsTrue(restClientParameters.RequestUrlSegments.Keys.Contains(urlSegment.Name));
                Assert.AreEqual(restClientParameters.RequestUrlSegments[urlSegment.Name], urlSegment.Value);
            }
        }
        public void Api_RestClientWrapper_GetRestRequest_ReturnsCorrectRequestWithCorrectHeaders(RestClientParameters restClientParameters)
        {
            var restClientWrapper = new RestClientWrapper(new RestClientWrapperCredentials());
            var result            = restClientWrapper.GetRestRequest(restClientParameters);

            var headers = result.Parameters.Where(x => x.Type == ParameterType.HttpHeader);
            var expectedHeadersCount = restClientParameters.RequestHeaders?.Count ?? 0;

            Assert.AreEqual(expectedHeadersCount, headers.Count());
            foreach (var header in headers)
            {
                Assert.IsTrue(restClientParameters.RequestHeaders.Keys.Contains(header.Name));
                Assert.AreEqual(restClientParameters.RequestHeaders[header.Name], header.Value);
            }
        }