public void TestSetOddLengthDocument() { // simple test var pdfIOD = new EncapsulatedPdfIod(); pdfIOD.EncapsulatedDocument.EncapsulatedDocument = new byte[1]; Assert.AreEqual(2, pdfIOD.EncapsulatedDocument.DicomAttributeProvider[DicomTags.EncapsulatedDocument].StreamLength); // set the document using pdf whose size is odd var pdf = System.Convert.FromBase64String(PDFOddLength); Assert.AreEqual(80929, pdf.Length); pdfIOD.EncapsulatedDocument.EncapsulatedDocument = pdf; Assert.AreEqual(80930, pdfIOD.EncapsulatedDocument.DicomAttributeProvider[DicomTags.EncapsulatedDocument].StreamLength); Assert.AreEqual(80930, pdfIOD.EncapsulatedDocument.EncapsulatedDocument.Length); pdfIOD.EncapsulatedDocument.MimeTypeOfEncapsulatedDocument = @"Application/PDF"; Assert.AreEqual(80930, pdfIOD.EncapsulatedDocument.DicomAttributeProvider[DicomTags.EncapsulatedDocument].StreamLength); Assert.AreEqual(80929, pdfIOD.EncapsulatedDocument.EncapsulatedDocument.Length); }
public void TestLoadDicomFileWithOddLengthDocument() { const long originalPdfFileSize = 0x33771; byte[] originalFile = System.Convert.FromBase64String(DicomFileWidthPdfOddLength); File.WriteAllBytes(@"testPdfOddLength.dcm", originalFile); DicomFile file = new DicomFile(@"testPdfOddLength.dcm"); file.Load(); var pdfIOD = new EncapsulatedPdfIod(file.DataSet); Assert.AreEqual(originalPdfFileSize, pdfIOD.EncapsulatedDocument.EncapsulatedDocument.Length); }