private static void TestPhysicalFile(string filePath, string mime) { var path = Path.GetFullPath(filePath); Trace.WriteLine("Sample file: " + path); Assert.AreEqual(mime, MimeHelper.GetMimeFromBytes(path)); var fi = new FileInfo(path); Assert.AreEqual(mime, fi.GetMimeFromBytes()); Assert.AreEqual(mime, fi.GetMimeFromFileName()); using (var fs = File.OpenRead(path)) Assert.AreEqual(mime, fs.GetMimeFromBytes()); using (var fs = File.OpenRead(path)) { var buffer = new byte[256]; fs.Read(buffer, 0, buffer.Length); Assert.AreEqual(mime, buffer.GetMimeFromBytes()); } }