public void Extension_Overrides_Default_Mime() { _mapper = new MimeMapper(new MimeMappingItem { Extension = "txt", MimeType = "my own mime type" }); Assert.AreEqual("my own mime type", _mapper.GetMimeFromPath(".txt")); Assert.AreEqual("my own mime type", _mapper.GetMimeFromPath("..\\..\\..\\text.txt")); }
/// <summary> /// Initializes a new instance of the <see cref="UploadFileRequestApiClientDecorator{TRequest, TResponse}"/> class. /// </summary> /// <param name="apiClient">The instance to decorate</param> /// <param name="mappers">The upload file mappers</param> /// <param name="mimeMapper">The mime mapper</param> public UploadFileRequestApiClientDecorator( IApiClient <TRequest, TResponse> apiClient, IReadOnlyList <IUploadFileRequestMapper <TRequest, TResponse> > mappers, IMimeMapper mimeMapper) : base(apiClient) { Argument.NotNull(apiClient, nameof(apiClient)); Argument.NotNullOrEmpty(mappers, nameof(mappers)); Argument.NotNull(mimeMapper, nameof(mimeMapper)); _apiClient = apiClient; _mappers = mappers; _mimeMapper = mimeMapper; }
/// <summary> /// Initializes a new instance of the <see cref="RestSharpApiClient{TRequest, TResponse}"/> class. /// </summary> /// <param name="clientFactory">The client factory</param> /// <param name="requestFactory">The request factory</param> /// <param name="queryStringBuilderFactory">The query string factory</param> /// <param name="converter">The converter</param> /// <param name="mimeMapper">The mime mapper</param> public RestSharpApiClient( IClientFactory clientFactory, IRequestFactory requestFactory, IQueryStringBuilderFactory queryStringBuilderFactory, IConverter <ResponseStatus?, ResponseStatusCode?> converter, IMimeMapper mimeMapper) { Argument.NotNull(clientFactory, nameof(clientFactory)); Argument.NotNull(requestFactory, nameof(requestFactory)); Argument.NotNull(queryStringBuilderFactory, nameof(queryStringBuilderFactory)); Argument.NotNull(converter, nameof(converter)); Argument.NotNull(mimeMapper, nameof(mimeMapper)); _clientFactory = clientFactory; _requestFactory = requestFactory; _queryStringBuilderFactory = queryStringBuilderFactory; _converter = converter; _mimeMapper = mimeMapper; }
public void Setup() { _mapper = new MimeMapper(); }
public void Extension_Overrides_Default_Mime() { _mapper = new MimeMapper(new MimeMappingItem {Extension = "txt", MimeType = "my own mime type"}); Assert.AreEqual("my own mime type", _mapper.GetMimeFromPath(".txt")); Assert.AreEqual("my own mime type", _mapper.GetMimeFromPath("..\\..\\..\\text.txt")); }