public void PerformWriteOpOnReadOnlyWrapper() { byte[] buf = new byte[10]; using (FileStreamWrapper fsw = new FileStreamWrapper()) { // If: // ... I have a readonly file stream wrapper // Then: // ... Attempting to perform any write operation should result in an exception Assert.Throws <InvalidOperationException>(() => fsw.WriteData(buf, 1)); Assert.Throws <InvalidOperationException>(() => fsw.Flush()); } }
public void PerformOpWithoutInit() { byte[] buf = new byte[10]; using (FileStreamWrapper fsw = new FileStreamWrapper()) { // If: // ... I have a file stream wrapper that hasn't been initialized // Then: // ... Attempting to perform any operation will result in an exception Assert.Throws <InvalidOperationException>(() => fsw.ReadData(buf, 1)); Assert.Throws <InvalidOperationException>(() => fsw.ReadData(buf, 1, 0)); Assert.Throws <InvalidOperationException>(() => fsw.WriteData(buf, 1)); Assert.Throws <InvalidOperationException>(() => fsw.Flush()); } }