public void GetMimeFromFileName_OverrideUserType_ReturnsOverrideValue()
        {
            const string mime = "application/x-ncontrib-testing";

            MimeHelper.UserTypes.Add(".bmp", mime);
            Assert.AreEqual(mime, MimeHelper.GetMimeFromFileName("image.bmp"));
        }
 public void GetMimeFromFileName_ValidMixedCaseExtensions_Found()
 {
     Assert.AreEqual("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", MimeHelper.GetMimeFromFileName("doc1.xlsx"));
     Assert.AreEqual("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", MimeHelper.GetMimeFromFileName("MYDOC.XLSX"));
     Assert.AreEqual("image/jpeg", MimeHelper.GetMimeFromFileName("pic.jpg"));
     Assert.AreEqual("image/jpeg", MimeHelper.GetMimeFromFileName("PIC.JPG"));
     Assert.AreEqual("image/jpeg", MimeHelper.GetMimeFromFileName("pic.Jpg"));
 }
        public void GetMimeFromFileName_NewUserTypes_Found()
        {
            var          random   = "." + Guid.NewGuid().ToString("N");
            const string mime     = "application/x-ncontrib-testing";
            var          tempPath = Path.GetTempFileName() + random;

            MimeHelper.UserTypes.Add(random, mime);
            Assert.AreEqual(mime, MimeHelper.GetMimeFromFileName(tempPath));
        }
 public void GetMimeFromFileName_NoExtensions_ReturnsDefault()
 {
     Assert.AreEqual(MimeHelper.DefaultMimeType, MimeHelper.GetMimeFromFileName(string.Empty));
     Assert.AreEqual(MimeHelper.DefaultMimeType, MimeHelper.GetMimeFromFileName("data"));
 }