/// <summary> /// Initializes a new instance of the <see cref="Stargate" /> class. /// </summary> /// <param name="options">The options.</param> /// <param name="resourceBuilderFactory">The resource builder factory.</param> /// <param name="restSharp">The RestSharp factory.</param> /// <param name="converterFactory">The converter factory.</param> /// <param name="errorProvider">The error provider.</param> /// <param name="scannerConverter">The scanner converter.</param> public Stargate(IStargateOptions options, Func <IStargateOptions, IResourceBuilder> resourceBuilderFactory, IRestSharpFactory restSharp, IMimeConverterFactory converterFactory, IErrorProvider errorProvider, IScannerOptionsConverter scannerConverter) { ResourceBuilder = resourceBuilderFactory(options); RestSharp = restSharp; ErrorProvider = errorProvider; ScannerConverter = scannerConverter; Client = RestSharp.CreateClient(options.ServerUrl); options.ContentType = string.IsNullOrEmpty(options.ContentType) ? DefaultContentType : options.ContentType; Converter = converterFactory.CreateConverter(options.ContentType); options.FalseRowKey = string.IsNullOrEmpty(options.FalseRowKey) ? DefaultFalseRowKey : options.FalseRowKey; Options = options; }
/// <summary> /// Initializes a new instance of the <see cref="Stargate" /> class. /// </summary> /// <param name="options">The options.</param> /// <param name="resourceBuilder">The resource builder.</param> /// <param name="restSharp">The RestSharp factory.</param> /// <param name="converterFactory">The converter factory.</param> /// <param name="errorProvider">The error provider.</param> /// <param name="scannerConverter">The scanner converter.</param> public Stargate(IStargateOptions options, IResourceBuilder resourceBuilder, IRestSharpFactory restSharp, IMimeConverterFactory converterFactory, IErrorProvider errorProvider, IScannerOptionsConverter scannerConverter) { _resourceBuilder = resourceBuilder; _restSharp = restSharp; _errorProvider = errorProvider; _scannerConverter = scannerConverter; _client = _restSharp.CreateClient(options.ServerUrl); options.ContentType = string.IsNullOrEmpty(options.ContentType) ? DefaultContentType : options.ContentType; _converter = converterFactory.CreateConverter(options.ContentType); options.FalseRowKey = string.IsNullOrEmpty(options.FalseRowKey) ? DefaultFalseRowKey : options.FalseRowKey; Options = options; }
private static IMimeConverter CreateRequestConverter(IRestRequest request, IMimeConverterFactory mimeConverterFactory) { string mimeType = request.Parameters .Where(parameter => parameter.Type == ParameterType.HttpHeader && IsAcceptOrContentType(parameter.Name)) .Select(parameter => parameter.Value.ToString()) .FirstOrDefault(); mimeType.Should().NotBeEmpty(); IMimeConverter converter = mimeConverterFactory.CreateConverter(mimeType); converter.Should().NotBeNull(); return(converter); }
public RequestVerification(RestContext rest, ErrorContext errors, IMoqContainer container) { _rest = rest; _errors = errors; _converterFactory = container.Create <IMimeConverterFactory>(); }
public RequestVerification(RestContext rest, ErrorContext errors, IMoqContainer container) { _rest = rest; _errors = errors; _converterFactory = container.Create<IMimeConverterFactory>(); }
private static IMimeConverter CreateRequestConverter(IRestRequest request, IMimeConverterFactory mimeConverterFactory) { string mimeType = request.Parameters .Where(parameter => parameter.Type == ParameterType.HttpHeader && IsAcceptOrContentType(parameter.Name)) .Select(parameter => parameter.Value.ToString()) .FirstOrDefault(); mimeType.Should().NotBeEmpty(); IMimeConverter converter = mimeConverterFactory.CreateConverter(mimeType); converter.Should().NotBeNull(); return converter; }