public void TestVideoFile(string type) { var path = SolutionPath + "test_file_" + type; var header = MimeChecker.GetFileHeader(path); DoTests(header, FileType.Video, type); }
public void Jpeg() { var header = MimeChecker.GetFileHeader(SolutionPath + "/Files/test_file_jpg"); Assert.NotNull(header, "File header returned null"); Assert.AreEqual(header.Type, FileType.Image, "File should be an image"); Assert.AreEqual(header.Extension, "jpg", "File format should be a jpg"); }
public void Wav() { var header = MimeChecker.GetFileHeader(SolutionPath + "/Files/test_file_wav"); Assert.NotNull(header, "File header returned null"); Assert.AreEqual(header.Type, FileType.Audio, "Should be an audio file"); Assert.AreEqual(header.Extension, "wav", "File format should be wav"); }
public void PartialSignature_IsDetected() { var buffer = new byte[] { 00, 00, 01, 0xB0 }; var checker = new MimeChecker(); for (int n = 0; n < 16; n++) { using (var stream = new MemoryStream(buffer)) { buffer[3] = (byte)(0xB0 | n); var header = checker.GetFileHeader(stream); Assert.AreEqual(FileType.Video, header.Type); Assert.AreEqual("mpg", header.Extension); } } }
public void Avi() { var header = MimeChecker.GetFileHeader(SolutionPath + "/Files/test_file_avi"); DoTests(header, FileType.Video, "avi"); }
public void Jpeg() { var header = MimeChecker.GetFileHeader(SolutionPath + "/Files/test_file_jpg"); DoTests(header, FileType.Image, "jpg"); }
public void Gif() { var header = MimeChecker.GetFileHeader(SolutionPath + "/Files/test_file_gif"); DoTests(header, FileType.Image, "gif"); }
public void Wav() { var header = MimeChecker.GetFileHeader(SolutionPath + "/Files/test_file_wav"); DoTests(header, FileType.Audio, "wav"); }