public void Constructor_UnreadableStream_ThrowsException() { var stream = new MemoryStream(); stream.Dispose(); // makes the stream unreadable var target = new WordprocessingDocumentIndexer(stream); }
public void Bytes_DisposedObject() { AssertFileExists(EmptyDocPath); var target = new WordprocessingDocumentIndexer(OpenFileReadWrite(EmptyDocPath)); target.SaveAndClose(); Assert.IsTrue(target.Disposed); var data = target.Bytes; }
public void Constructor_EmptyDoc_ValidState() { var docBytes = LoadTestFileBytes(EmptyDocPath); if (docBytes != null) { using (var target = new WordprocessingDocumentIndexer(docBytes)) { Assert.IsNotNull(target); Assert.IsNotNull(target.Document); Assert.IsFalse(target.Disposed); // Check properties Assert.IsNotNull(target.Data); Assert.IsTrue(target.Data.Length > 0); Assert.IsTrue(target.Bytes.Length > 0); } } }
public void Constructor_NullStream_ThrowsException() { var target = new WordprocessingDocumentIndexer((Stream)null); }
public void Constructor_NullByteArray_ThrowsException() { var target = new WordprocessingDocumentIndexer((byte[])null); }
public void Constructor_EmptyStream_ThrowsException() { var target = new WordprocessingDocumentIndexer(new MemoryStream()); }
public void Constructor_EmptyByteArray_ThrowsException() { var target = new WordprocessingDocumentIndexer(new byte[0]); }
public void SaveAndReopen_DoesNotDisposeIndexer() { AssertFileExists(EmptyDocPath); using (var target = new WordprocessingDocumentIndexer(OpenFileReadWrite(EmptyDocPath))) { target.SaveAndReopen(); Assert.IsFalse(target.Disposed); } }
public void ImplicitCast_ValidIndexer_SameReference() { AssertFileExists(EmptyDocPath); using (var target = new WordprocessingDocumentIndexer(OpenFileReadWrite(EmptyDocPath))) { WordprocessingDocument doc = (WordprocessingDocument)target; Assert.IsNotNull(doc); Assert.AreSame(target.WordprocessingDocument, doc); } }