public void NoStreamExceptionThrownWhenNoStreamIsAssigned() { this.SetUp(); this.streamDecorator = new StreamDecoratorTestStream(null); this.streamDecorator.Position = 10; }
public void ToStringGetInformationFromDecoratedDevice() { this.SetUp(); this.streamDecorator = new StreamDecoratorTestStream(this.testStream); Assert.AreEqual(this.streamDecorator.ToString(), this.testStream.ToString()); }
public void CloseRequestForwardedToDecoratedStream() { this.SetUp(); this.streamDecorator = new StreamDecoratorTestStream(this.testStream); this.streamDecorator.Close(); Assert.IsTrue(this.testStream.CloseWasCalled); }
public void FlushRequestForwardedToDecoratedStream() { this.SetUp(); this.streamDecorator = new StreamDecoratorTestStream(this.testStream); this.streamDecorator.Flush(); Assert.IsTrue(this.testStream.FlushWasCalled); }
public void CanWriteGetInformationFromDecoratedDevice() { this.SetUp(); this.streamDecorator = new StreamDecoratorTestStream(this.testStream); this.testStream.SetCanWrite(true); Assert.IsTrue(this.streamDecorator.CanWrite); this.testStream.SetCanWrite(false); Assert.IsFalse(this.streamDecorator.CanWrite); }
public void SeekRequestForwardedToDecoratedStream() { this.SetUp(); this.streamDecorator = new StreamDecoratorTestStream(this.testStream); this.streamDecorator.Seek(999, SeekOrigin.End); Assert.IsTrue(this.testStream.SeekWasCalled); Assert.AreEqual(this.testStream.SeekOffset, 999); Assert.AreEqual(this.testStream.SeekOrigin, SeekOrigin.End); }
public void SetLengthSetsLengthOfDecoratedDevice() { this.SetUp(); this.streamDecorator = new StreamDecoratorTestStream(this.testStream); this.streamDecorator.SetLength(100); Assert.AreEqual(this.testStream.Length, 100); this.streamDecorator.SetLength(200); Assert.AreEqual(this.testStream.Length, 200); }
public void WriteTimeoutGetInformationFromDecoratedDevice() { this.SetUp(); this.streamDecorator = new StreamDecoratorTestStream(this.serialStream); this.serialStream.WriteTimeout = 100; Assert.AreEqual(this.streamDecorator.WriteTimeout, 100); this.serialStream.WriteTimeout = 200; Assert.AreEqual(this.streamDecorator.WriteTimeout, 200); this.streamDecorator.WriteTimeout = 300; Assert.AreEqual(this.serialStream.WriteTimeout, 300); this.streamDecorator.WriteTimeout = 400; Assert.AreEqual(this.serialStream.WriteTimeout, 400); }
/// <summary> /// Sets up each test. /// Creates the object under test and the test streams. /// </summary> public void SetUp() { if (!this.canRun) { throw new IgnoreException("Com1 not defined"); } this.serialPort = new SerialPort(); this.serialPort.PortName = "Com1"; this.serialPort.Open(); this.serialStream = this.serialPort.BaseStream; this.memoryStream = new MemoryStream(); this.streamDecorator = new StreamDecoratorTestStream(this.memoryStream); this.testStream = new TestStream(); }