Exemplo n.º 1
0
        public void AbortReadIfTransmissionEventIsAborting()
        {
            byte[] content      = new byte[1024];
            var    transmission = new FileTransmissionEvent(this.transmissionType, this.filename);

            using (var stream = new MemoryStream(content))
                using (var progressStream = new ProgressStream(stream, transmission))
                {
                    transmission.ReportProgress(new TransmissionProgressEventArgs()
                    {
                        Aborting = true
                    });
                    Assert.Throws <AbortException>(() => progressStream.ReadByte());
                }
        }