public void BinaryReaderConstructor_ValidArguments_IsProperlyInitialized() { // Act StaMa.BinaryReader reader = new StaMa.BinaryReader(new MemoryStream(new Byte[] { }), System.Text.Encoding.UTF8); // Assert Assert.That(delegate() { reader.ReadByte(); }, Throws.TypeOf(typeof(IOException))); Assert.That(delegate() { reader.Dispose(); }, Throws.Nothing); Assert.That(delegate() { reader.ReadByte(); }, Throws.TypeOf(typeof(ObjectDisposedException))); Assert.That(delegate() { reader.ReadInt16(); }, Throws.TypeOf(typeof(ObjectDisposedException))); Assert.That(delegate() { reader.ReadString(); }, Throws.TypeOf(typeof(ObjectDisposedException))); Assert.That(delegate() { reader.ToString(); }, Throws.Nothing); Assert.That(delegate() { reader.Dispose(); }, Throws.Nothing); // 2nd Dispose doesn't access any cleared members. Assert.That(delegate() { reader.Close(); }, Throws.Nothing); // Act StaMa.BinaryReader reader2 = new StaMa.BinaryReader(new MemoryStream(new Byte[] { }), System.Text.Encoding.UTF8); // Assert Assert.That(delegate() { reader2.Close(); }, Throws.Nothing); Assert.That(delegate() { reader2.ReadByte(); }, Throws.TypeOf(typeof(ObjectDisposedException))); }