| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 | using System;using System.IO;using Microsoft.VisualStudio.TestTools.UnitTesting;using Renci.SshNet.Sftp;namespace Renci.SshNet.Tests.Classes.Sftp{    [TestClass]    public class SftpFileStreamTest_Ctor_FileModeInvalid : SftpFileStreamTestBase    {        private Random _random;        private string _path;        private FileMode _fileMode;        private FileAccess _fileAccess;        private int _bufferSize;        private ArgumentOutOfRangeException _actualException;        protected override void SetupData()        {            base.SetupData();            _random = new Random();            _path = _random.Next().ToString();            _fileMode = 0;            _fileAccess = FileAccess.Read;            _bufferSize = _random.Next(5, 1000);        }        protected override void SetupMocks()        {        }        protected override void Act()        {            try            {                new SftpFileStream(SftpSessionMock.Object, _path, _fileMode, _fileAccess, _bufferSize);                Assert.Fail();            }            catch (ArgumentOutOfRangeException ex)            {                _actualException = ex;            }        }        [TestMethod]        public void CtorShouldHaveThrownArgumentException()        {            Assert.IsNotNull(_actualException);            Assert.IsNull(_actualException.InnerException);            Assert.AreEqual("mode", _actualException.ParamName);        }    }}
 |