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"));
 }
示例#2
0
 /// <summary>
 /// 可断点续传和多线程下载的FileResult
 /// </summary>
 /// <param name="controller"></param>
 /// <param name="fileContents">文件二进制流</param>
 /// <param name="fileDownloadName">下载的文件名</param>
 /// <returns></returns>
 public static ResumeFileContentResult ResumeFile(this ControllerBase controller, byte[] fileContents, string fileDownloadName)
 {
     return(ResumeFile(controller, fileContents, _mimeMapper.GetMimeFromPath(fileDownloadName), fileDownloadName, null));
 }
 public void It_Searches_In_Full_Path()
 {
     Assert.AreEqual("image/gif", _mapper.GetMimeFromPath("C:\\folder1\\folder2\\text.gif"));
 }
 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"));
 }