Esempio n. 1
0
        public void FromDataFormatToRestSharpDataFormat_IfDataFormatExists_MapsCorrectly(
            DataFormat source,
            RestSharp.DataFormat expected)
        {
            var result = source.Map <DataFormat, RestSharp.DataFormat>();

            Assert.AreEqual(expected, result);
        }
Esempio n. 2
0
        public void GetRestRequest_IfDataFormatDoesNotExist_ThrowsException(
            DataFormat format)
        {
            var restClientParameters = new RestClientParameters {
                RequestDataFormat = format
            };
            var restClientWrapper = new SDK.Utilities.RestClientWrapper.RestClientWrapper();

            Assert.Catch(() => restClientWrapper.GetRestRequest(restClientParameters));
        }
Esempio n. 3
0
        public void GetRestClient_IDataFormatDoesNotExist_ThrowsException(DataFormat responseDataFormat)
        {
            var wrapper = new SDK.Utilities.RestClientWrapper.RestClientWrapper(It.IsAny <RestClientCredentials>());
            var restClientParameters = new RestClientParameters
            {
                BaseUrl            = TestValidUrl,
                ResponseDataFormat = responseDataFormat,
            };

            Assert.Catch(() => wrapper.GetRestClient(restClientParameters));
        }
Esempio n. 4
0
        private RestSharp.DataFormat ConvertDataFormat(DataFormat source)
        {
            switch (source)
            {
            case DataFormat.Xml:
                return(RestSharp.DataFormat.Xml);

            case DataFormat.Json:
                return(RestSharp.DataFormat.Json);

            default:
                throw new ArgumentOutOfRangeException(nameof(source), source, null);
            }
        }
Esempio n. 5
0
 public void FromDataFormatToRestSharpDataFormat_IfDataFormatDoesNotExist_ThrowsException(DataFormat source)
 {
     Assert.Catch(() => source.Map <DataFormat, RestSharp.DataFormat>());
 }