public void FromDataFormatToRestSharpDataFormat_IfDataFormatExists_MapsCorrectly( DataFormat source, RestSharp.DataFormat expected) { var result = source.Map <DataFormat, RestSharp.DataFormat>(); Assert.AreEqual(expected, result); }
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)); }
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)); }
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); } }
public void FromDataFormatToRestSharpDataFormat_IfDataFormatDoesNotExist_ThrowsException(DataFormat source) { Assert.Catch(() => source.Map <DataFormat, RestSharp.DataFormat>()); }