public void IsDjvuDocument_String005() { string filePath = Path.GetTempFileName() + "2.djvu"; FileStream fs = null; try { try { fs = File.Create(filePath); byte[] buffer = new byte[DjvuDocument.MagicBuffer.Length]; Buffer.BlockCopy(DjvuDocument.MagicBuffer, 0, buffer, 0, buffer.Length); Array.Reverse(buffer); fs.Write(buffer, 0, buffer.Length); fs.Write(buffer, 0, buffer.Length); fs.WriteByte(0x4e); fs.Flush(); } finally { fs.Close(); } bool result = DjvuDocument.IsDjvuDocument(filePath); Assert.False(result); } finally { if (File.Exists(filePath)) { File.Delete(filePath); } } }
public void IsDjvuDocument_String004() { string filePath = Path.GetTempFileName() + "1.djvu"; FileStream fs = null; try { try { fs = File.Create(filePath); fs.Write(DjvuDocument.MagicBuffer, 0, DjvuDocument.MagicBuffer.Length); fs.Write(DjvuDocument.MagicBuffer, 0, DjvuDocument.MagicBuffer.Length); fs.WriteByte(0x4e); fs.Flush(); } finally { fs.Close(); } bool result = DjvuDocument.IsDjvuDocument(filePath); Assert.True(result); } finally { if (File.Exists(filePath)) { File.Delete(filePath); } } }
public void IsDjvuDocument_Stream006() { using (MemoryStream stream = new MemoryStream(DjvuDocument.MagicBuffer)) { Assert.Equal(8, stream.Length); Assert.False(DjvuDocument.IsDjvuDocument(stream)); } }
public void IsDjvuDocument_Stream005() { using (MemoryStream stream = new MemoryStream(new byte[4])) { Assert.Equal(4, stream.Length); Assert.False(DjvuDocument.IsDjvuDocument(stream)); } }
public void IsDjvuDocument_String006() { string errorPath = Path.GetTempFileName(); using (FileStream stream = new FileStream(errorPath, FileMode.Open, FileAccess.Read, FileShare.None)) { Assert.Throws <DjvuAggregateException>(() => DjvuDocument.IsDjvuDocument(errorPath)); } }
public void IsDjvuDocument_Stream007() { byte[] buffer = new byte[] { 0x41, 0x54, 0x26, 0x54, 0x46, 0x4f, 0x52, 0x4d, 0x41, 0x54, 0x26, 0x54, 0x46, 0x4f, 0x52, 0x4d }; using (MemoryStream stream = new MemoryStream(buffer)) { Assert.Equal(16, stream.Length); stream.Position = 10; Assert.True(DjvuDocument.IsDjvuDocument(stream)); } }
public void IsDjvuDocument_Stream003() { byte[] buffer = DjvuDocument.MagicBuffer; byte[] target = new byte[buffer.Length * 3]; Buffer.BlockCopy(buffer, 0, target, 0, buffer.Length); using (MemoryStream stream = new MemoryStream(target)) { bool result = DjvuDocument.IsDjvuDocument(stream); Assert.True(result); } }
public void IsDjvuDocument_Stream002() { StreamMock stream = new StreamMock(); Assert.Throws <DjvuArgumentException>("stream", () => DjvuDocument.IsDjvuDocument(stream)); }
public void IsDjvuDocument_Stream001() { Stream stream = null; Assert.Throws <DjvuArgumentNullException>("stream", () => DjvuDocument.IsDjvuDocument(stream)); }
public void IsDjvuDocument_String003() { string errorPath = null; Assert.Throws <DjvuArgumentNullException>("filePath", () => DjvuDocument.IsDjvuDocument(errorPath)); }
public void IsDjvuDocument_String001() { string errorPath = "xyzzyx"; Assert.Throws <DjvuFileNotFoundException>(() => DjvuDocument.IsDjvuDocument(errorPath)); }
public void IsDjvuDocument_String_Theory(string filePath, int pageCount) { Assert.True(DjvuDocument.IsDjvuDocument(filePath)); }