Merge remote-tracking branch 'remotes/origin/develop'

This commit is contained in:
drieseng
2020-05-03 13:19:21 +02:00
356 changed files with 38435 additions and 7989 deletions
+74 -7
View File
@@ -1,12 +1,29 @@
SSH.NET
SSH.NET
=======
SSH.NET is a Secure Shell (SSH-2) library for .NET, optimized for parallelism.
[![Version](https://img.shields.io/nuget/vpre/SSH.NET.svg)](https://www.nuget.org/packages/SSH.NET)
[![NuGet download count](https://img.shields.io/nuget/dt/SSH.NET.svg)](https://www.nuget.org/packages/SSH.NET)
[![Build status](https://ci.appveyor.com/api/projects/status/ih77qu6tap3o92gu/branch/develop?svg=true)](https://ci.appveyor.com/api/projects/status/ih77qu6tap3o92gu/branch/develop)
## Introduction
This project was inspired by **Sharp.SSH** library which was ported from java and it seems like was not supported for quite some time. This library is a complete rewrite, without any third party dependencies, using parallelism to achieve the best performance possible.
This project was inspired by **Sharp.SSH** library which was ported from java and it seems like was not supported
for quite some time. This library is a complete rewrite, without any third party dependencies, using parallelism
to achieve the best performance possible.
## Documentation
There is MSDN-style class documentation in a .chm file for each release, which you can find in the Assets section
of the [latest release](https://github.com/sshnet/SSH.NET/releases/latest) page. Please note that you will need
to [right-click and "unblock"](https://support.microsoft.com/en-us/help/2021383/some-chm-files-may-not-render-properly-on-windows-vista-and-windows-7)
the CHM file after you download it.
Currently (4/18/2020), the documentation is very sparse. Fortunately, there are a large number of tests in
[Renci.SshNet.Tests](https://github.com/sshnet/SSH.NET/tree/develop/src/Renci.SshNet.Tests) that demonstrate
usage with working code.
If the test for the functionality you would like to see documented is not complete, then you are cordially
invited to read the source, Luke, and highly encouraged to generate a pull request for the implementation of
the missing test once you figure things out. 🤓
## Features
* Execution of SSH command using both synchronous and asynchronous methods
@@ -17,22 +34,72 @@ This project was inspired by **Sharp.SSH** library which was ported from java an
* Remote, dynamic and local port forwarding
* Shell/Terminal implementation
* Specify key file pass phrase
* Use multiple key files to authenticate
* Supports 3des-cbc, aes128-cbc, aes192-cbc, aes256-cbc, aes128-ctr, aes192-ctr, aes256-ctr, blowfish-cbc, cast128-cbc, arcfour and twofish encryptions
* Use multiple key files to authenticate
* Supports publickey, password and keyboard-interactive authentication methods
* Supports RSA and DSA private key
* Supports DES-EDE3-CBC, DES-EDE3-CFB, DES-CBC, AES-128-CBC, AES-192-CBC and AES-256-CBC algorithms for private key encryption
* Supports two-factor or higher authentication
* Supports SOCKS4, SOCKS5 and HTTP Proxy
## Encryption Method
**SSH.NET** supports the following encryption methods:
* aes256-ctr
* 3des-cbc
* aes128-cbc
* aes192-cbc
* aes256-cbc
* blowfish-cbc
* twofish-cbc
* twofish192-cbc
* twofish128-cbc
* twofish256-cbc
* arcfour
* arcfour128
* arcfour256
* cast128-cbc
* aes128-ctr
* aes192-ctr
## Key Exchange Method
**SSH.NET** supports the following key exchange methods:
* curve25519-sha256
* curve25519-sha256<span></span>@libssh.org
* ecdh-sha2-nistp256
* ecdh-sha2-nistp384
* ecdh-sha2-nistp521
* diffie-hellman-group-exchange-sha256
* diffie-hellman-group-exchange-sha1
* diffie-hellman-group16-sha512
* diffie-hellman-group14-sha256
* diffie-hellman-group14-sha1
* diffie-hellman-group1-sha1
## Public Key Authentication
**SSH.NET** supports the following private key formats:
* RSA in OpenSSL PEM and ssh.com format
* DSA in OpenSSL PEM and ssh.com format
* ECDSA 256/384/521 in OpenSSL PEM format
* ED25519 in OpenSSH key format
Private keys can be encrypted using one of the following cipher methods:
* DES-EDE3-CBC
* DES-EDE3-CFB
* DES-CBC
* AES-128-CBC
* AES-192-CBC
* AES-256-CBC
## Host Key Algorithms
**SSH.NET** supports the following host key algorithms:
* ssh-ed25519
* ecdsa-sha2-nistp256
* ecdsa-sha2-nistp384
* ecdsa-sha2-nistp521
* ssh-rsa
* ssh-dss
## Message Authentication Code
**SSH.NET** supports the following MAC algorithms:
@@ -45,7 +112,7 @@ This project was inspired by **Sharp.SSH** library which was ported from java an
* hmac-sha2-512
* hmac-sha2-512-96
* hmac-ripemd160
* hmac-ripemd160@openssh.com
* hmac-ripemd160<span></span>@openssh.com
## Framework Support
**SSH.NET** supports the following target frameworks:
+73
View File
@@ -0,0 +1,73 @@
SSH.NET uses third-party libraries or other resources that may be
distributed under licenses different than the SSH.NET software.
License notice for BouncyCastle
-------------------------------
http://bouncycastle.org/csharp
Copyright (c) 2000 - 2018 The Legion of the Bouncy Castle Inc. (http://www.bouncycastle.org)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
License notice for Chaos.NaCl
-------------------------------
https://github.com/CodesInChaos/Chaos.NaCl
Public domain
C# port + code by Christian Winnerlein (CodesInChaos)
Poly1305 in c
written by Andrew M. (floodyberry)
original license: MIT or PUBLIC DOMAIN
https://github.com/floodyberry/poly1305-donna/blob/master/poly1305-donna-unrolled.c
Curve25519 and Ed25519 in c
written by Dan Bernstein (djb)
public domain
from Ref10 in SUPERCOP http://bench.cr.yp.to/supercop.html
(H)Salsa20 in c
written by Dan Bernstein (djb)
public domain
from SUPERCOP http://bench.cr.yp.to/supercop.html
SHA512
written by Christian Winnerlein (CodesInChaos)
public domain
directly from the specification
License notice for BCrypt
-------------------------
Copyright (c) 2006 Damien Miller <djm@mindrot.org>
Copyright (c) 2010 Ryan D. Emerle
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+5 -5
View File
@@ -1,14 +1,14 @@
os: Visual Studio 2015
os: Visual Studio 2019
before_build:
- nuget restore src\Renci.SshNet.VS2015.sln
- nuget restore src\Renci.SshNet.VS2019.sln
build:
project: src\Renci.SshNet.VS2015.sln
project: src\Renci.SshNet.VS2019.sln
verbosity: minimal
test_script:
- cmd: >-
vstest.console /logger:Appveyor src\Renci.SshNet.Tests\bin\Debug\Renci.SshNet.Tests.dll /TestCaseFilter:"TestCategory!=integration&TestCategory!=LongRunning"
vstest.console /logger:Appveyor src\Renci.SshNet.Tests\bin\Debug\net40\Renci.SshNet.Tests.dll /TestCaseFilter:"TestCategory!=integration&TestCategory!=LongRunning"
vstest.console /logger:Appveyor src\Renci.SshNet.Tests.NET35\bin\Debug\Renci.SshNet.Tests.NET35.dll /TestCaseFilter:"TestCategory!=integration&TestCategory!=LongRunning"
vstest.console /logger:Appveyor src\Renci.SshNet.Tests\bin\Debug\net35\Renci.SshNet.Tests.dll /TestCaseFilter:"TestCategory!=integration&TestCategory!=LongRunning"
-12
View File
@@ -1,12 +0,0 @@
@echo off
set MSBUILD14_EXE=%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe
set MSBUILD15_EXE=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\\MSBuild\15.0\bin\MSBuild.exe
call "%MSBUILD14_EXE%" build.proj /t:Clean
call "%MSBUILD15_EXE%" build.proj /t:Clean
call "%MSBUILD14_EXE%" build.proj /t:Build
call "%MSBUILD15_EXE%" build.proj /t:Build
call "%MSBUILD15_EXE%" build.proj /t:Package /p:ReleaseVersion=%1
+175 -89
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask TaskName="Zip" AssemblyFile="$(MSBuildThisFileDirectory)target\nuget\packages\$(MSBuildTasksPackageId).$(MSBuildTasksPackageVersion)\tools\MSBuild.Community.Tasks.dll"/>
<PropertyGroup>
<Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
@@ -8,128 +8,214 @@
<MSBuildTasksPackageId>MSBuildTasks</MSBuildTasksPackageId>
<MSBuildTasksPackageVersion>1.5.0.214</MSBuildTasksPackageVersion>
</PropertyGroup>
<ItemGroup>
<VisualStudioVersion Include="2012">
<VisualStudioVersionClassic Include="2012">
<SolutionFile>$(MSBuildThisFileDirectory)..\src\Renci.SshNet.VS2012.sln</SolutionFile>
<MSBuildToolsVersion>14.0</MSBuildToolsVersion>
<NuGetPackageRestore>true</NuGetPackageRestore>
</VisualStudioVersion>
<VisualStudioVersion Include="2015">
<ToolsVersion>14.0</ToolsVersion>
<VisualStudioVersion>14.0</VisualStudioVersion>
</VisualStudioVersionClassic>
<VisualStudioVersionClassic Include="2015">
<SolutionFile>$(MSBuildThisFileDirectory)..\src\Renci.SshNet.VS2015.sln</SolutionFile>
<MSBuildToolsVersion>14.0</MSBuildToolsVersion>
<NuGetPackageRestore>true</NuGetPackageRestore>
</VisualStudioVersion>
<VisualStudioVersion Include="2017">
<SolutionFile>$(MSBuildThisFileDirectory)..\src\Renci.SshNet.VS2017.sln</SolutionFile>
<MSBuildToolsVersion>15.0</MSBuildToolsVersion>
</VisualStudioVersion>
<ToolsVersion>14.0</ToolsVersion>
<VisualStudioVersion>14.0</VisualStudioVersion>
</VisualStudioVersionClassic>
</ItemGroup>
<ItemGroup>
<TargetFramework Include=".NET Framework 3.5">
<OutputDirectory>Renci.SshNet.NET35\bin\$(Configuration)</OutputDirectory>
<Moniker>net35</Moniker>
</TargetFramework>
<TargetFramework Include=".NET Framework 4.0">
<OutputDirectory>Renci.SshNet\bin\$(Configuration)</OutputDirectory>
<Moniker>net40</Moniker>
</TargetFramework>
<TargetFramework Include=".NETStandard 1.3">
<OutputDirectory>Renci.SshNet.NETCore\bin\$(Configuration)\netstandard1.3</OutputDirectory>
<Moniker>netstandard1.3</Moniker>
</TargetFramework>
<TargetFramework Include="Windows Phone Silverlight 7.1">
<VisualStudioVersionModern Include="2019">
<SolutionFile>$(MSBuildThisFileDirectory)..\src\Renci.SshNet.VS2019.sln</SolutionFile>
<VisualStudioVersion>16.0</VisualStudioVersion>
</VisualStudioVersionModern>
</ItemGroup>
<ItemGroup>
<TargetFrameworkClassic Include="Windows Phone Silverlight 7.1">
<OutputDirectory>Renci.SshNet.WindowsPhone\bin\$(Configuration)</OutputDirectory>
<Moniker>wp71</Moniker>
</TargetFramework>
<TargetFramework Include="Windows Phone Silverlight 8.0">
</TargetFrameworkClassic>
<TargetFrameworkClassic Include="Windows Phone Silverlight 8.0">
<OutputDirectory>Renci.SshNet.WindowsPhone8\bin\$(Configuration)</OutputDirectory>
<Moniker>wp8</Moniker>
</TargetFramework>
<TargetFramework Include="Silverlight 4">
</TargetFrameworkClassic>
<TargetFrameworkClassic Include="Silverlight 4">
<OutputDirectory>Renci.SshNet.Silverlight\bin\$(Configuration)</OutputDirectory>
<Moniker>sl4</Moniker>
</TargetFramework>
<TargetFramework Include="Silverlight 5">
</TargetFrameworkClassic>
<TargetFrameworkClassic Include="Silverlight 5">
<OutputDirectory>Renci.SshNet.Silverlight5\bin\$(Configuration)</OutputDirectory>
<Moniker>sl5</Moniker>
</TargetFramework>
<TargetFramework Include="Universal Windows Platform 10">
</TargetFrameworkClassic>
<TargetFrameworkClassic Include="Universal Windows Platform 10">
<OutputDirectory>Renci.SshNet.UAP10\bin\$(Configuration)</OutputDirectory>
<Moniker>uap10</Moniker>
</TargetFramework>
</TargetFrameworkClassic>
</ItemGroup>
<Target Name="Clean">
<ItemGroup>
<TargetFrameworkModern Include=".NET Framework 3.5">
<OutputDirectory>Renci.SshNet\bin\$(Configuration)\net35</OutputDirectory>
<Moniker>net35</Moniker>
</TargetFrameworkModern>
<TargetFrameworkModern Include=".NET Framework 4.0">
<OutputDirectory>Renci.SshNet\bin\$(Configuration)\net40</OutputDirectory>
<Moniker>net40</Moniker>
</TargetFrameworkModern>
<TargetFrameworkModern Include=".NETStandard 1.3">
<OutputDirectory>Renci.SshNet\bin\$(Configuration)\netstandard1.3</OutputDirectory>
<Moniker>netstandard1.3</Moniker>
</TargetFrameworkModern>
<TargetFrameworkModern Include=".NETStandard 2.0">
<OutputDirectory>Renci.SshNet\bin\$(Configuration)\netstandard2.0</OutputDirectory>
<Moniker>netstandard2.0</Moniker>
</TargetFrameworkModern>
</ItemGroup>
<Target Name="CleanClassic" DependsOnTargets="CleanSolutionClassic">
<RemoveDir Directories="$(MSBuildThisFileDirectory)target"/>
</Target>
<Target Name="CleanModern" DependsOnTargets="CleanSolutionModern">
<RemoveDir Directories="$(MSBuildThisFileDirectory)target"/>
</Target>
<Target Name="CleanSolutionClassic" Outputs="%(VisualStudioVersionClassic.Identity)">
<ItemGroup>
<ProjectToBuild Remove="@(ProjectToBuild)"/>
<ProjectToBuild Include="%(VisualStudioVersion.SolutionFile)" Condition="'%(VisualStudioVersion.MSBuildToolsVersion)'=='$(MSBuildToolsVersion)'">
<Properties>Configuration=Release</Properties>
<ProjectToBuild Include="%(VisualStudioVersionClassic.SolutionFile)">
<Properties>Configuration=Release;VisualStudioVersion=%(VisualStudioVersionClassic.VisualStudioVersion)</Properties>
</ProjectToBuild>
</ItemGroup>
<MSBuild Projects="@(ProjectToBuild)" Targets="Clean" />
<MSBuild Projects="@(ProjectToBuild)" ToolsVersion="%(VisualStudioVersionClassic.ToolsVersion)" Targets="Clean"/>
</Target>
<Target Name="CleanSolutionModern" Outputs="%(VisualStudioVersionModern.Identity)">
<ItemGroup>
<ProjectToBuild Remove="@(ProjectToBuild)"/>
<ProjectToBuild Include="%(VisualStudioVersionModern.SolutionFile)">
<Properties>Configuration=Release;VisualStudioVersion=%(VisualStudioVersionModern.VisualStudioVersion)</Properties>
</ProjectToBuild>
</ItemGroup>
<MSBuild Projects="@(ProjectToBuild)" Targets="Clean"/>
</Target>
<Target Name="RestoreNuGetPackagesClassic" DependsOnTargets="DownloadNuGet" Outputs="%(VisualStudioVersionClassic.Identity)">
<Message Text="Restoring nuget packages for '%(VisualStudioVersionClassic.SolutionFile)'..." Importance="High"/>
<Exec Command="$(NuGetExe) restore &quot;%(VisualStudioVersionClassic.SolutionFile)&quot;"/>
</Target>
<Target Name="RestoreNuGetPackagesModern" DependsOnTargets="DownloadNuGet" Outputs="%(VisualStudioVersionModern.Identity)">
<Message Text="Restoring nuget packages for '%(VisualStudioVersionModern.SolutionFile)'..." Importance="High"/>
<Exec Command="$(NuGetExe) restore &quot;%(VisualStudioVersionModern.SolutionFile)&quot;"/>
</Target>
<Target Name="BuildClassic" DependsOnTargets="RestoreNuGetPackagesClassic" Outputs="%(VisualStudioVersionClassic.Identity)">
<ItemGroup>
<ProjectToBuild Remove="@(ProjectToBuild)"/>
<ProjectToBuild Include="%(VisualStudioVersionClassic.SolutionFile)">
<Properties>Configuration=Release;VisualStudioVersion=%(VisualStudioVersionClassic.VisualStudioVersion)</Properties>
</ProjectToBuild>
</ItemGroup>
<MSBuild Projects="@(ProjectToBuild)" ToolsVersion="%(VisualStudioVersionClassic.ToolsVersion)" Targets="Rebuild"/>
</Target>
<Target Name="BuildModern" DependsOnTargets="RestoreNuGetPackagesModern" Outputs="%(VisualStudioVersionModern.Identity)">
<ItemGroup>
<ProjectToBuild Remove="@(ProjectToBuild)"/>
<ProjectToBuild Include="%(VisualStudioVersionModern.SolutionFile)">
<Properties>Configuration=Release;VisualStudioVersion=%(VisualStudioVersionModern.VisualStudioVersion)</Properties>
</ProjectToBuild>
</ItemGroup>
<MSBuild Projects="@(ProjectToBuild)" ToolsVersion="%(VisualStudioVersionModern.ToolsVersion)" Targets="Rebuild"/>
</Target>
<Target Name="Package" DependsOnTargets="CreateNuGetPackage;CreateBinPackage;GenerateHelpFile"/>
<Target Name="ValidatePackage" DependsOnTargets="ValidatePackageClassic;ValidatePackageModern"/>
<Target Name="ValidatePackageClassic" DependsOnTargets="CheckNuGetPackageDirectory;CheckBinaryZipPackageDirectory" Outputs="%(TargetFrameworkClassic.Identity)">
<Error Text="The 'Renci.SshNet.dll' file is not available for %(TargetFrameworkClassic.Identity) in $(NuGetPackageDirectory)\lib\%(TargetFrameworkClassic.Moniker)." Condition="!Exists('$(NuGetPackageDirectory)\lib\%(TargetFrameworkClassic.Moniker)\Renci.SshNet.dll')"/>
<Error Text="The 'Renci.SshNet.xml' file is not available for %(TargetFrameworkClassic.Identity) in $(NuGetPackageDirectory)\lib\%(TargetFrameworkClassic.Moniker)." Condition="!Exists('$(NuGetPackageDirectory)\lib\%(TargetFrameworkClassic.Moniker)\Renci.SshNet.xml')"/>
<Error Text="The 'Renci.SshNet.dll' file is not available for %(TargetFrameworkClassic.Identity) in $(BinaryZipPackageDirectory)\lib\%(TargetFrameworkClassic.Moniker)" Condition="!Exists('$(BinaryZipPackageDirectory)\lib\%(TargetFrameworkClassic.Moniker)\Renci.SshNet.dll')"/>
<Error Text="The 'Renci.SshNet.xml' file is not available for %(TargetFrameworkClassic.Identity) in $(BinaryZipPackageDirectory)\lib\%(TargetFrameworkClassic.Moniker)" Condition="!Exists('$(BinaryZipPackageDirectory)\lib\%(TargetFrameworkClassic.Moniker)\Renci.SshNet.xml')"/>
</Target>
<Target Name="ValidatePackageModern" DependsOnTargets="CheckNuGetPackageDirectory;CheckBinaryZipPackageDirectory" Outputs="%(TargetFrameworkModern.Identity)">
<Error Text="The 'Renci.SshNet.dll' file is not available for %(TargetFrameworkModern.Identity) in $(NuGetPackageDirectory)\lib\%(TargetFrameworkModern.Moniker)." Condition="!Exists('$(NuGetPackageDirectory)\lib\%(TargetFrameworkModern.Moniker)\Renci.SshNet.dll')"/>
<Error Text="The 'Renci.SshNet.xml' file is not available for %(TargetFrameworkModern.Identity) in $(NuGetPackageDirectory)\lib\%(TargetFrameworkModern.Moniker)." Condition="!Exists('$(NuGetPackageDirectory)\lib\%(TargetFrameworkModern.Moniker)\Renci.SshNet.xml')"/>
<Error Text="The 'Renci.SshNet.dll' file is not available for %(TargetFrameworkModern.Identity) in $(BinaryZipPackageDirectory)\lib\%(TargetFrameworkModern.Moniker)." Condition="!Exists('$(BinaryZipPackageDirectory)\lib\%(TargetFrameworkModern.Moniker)\Renci.SshNet.dll')"/>
<Error Text="The 'Renci.SshNet.xml' file is not available for %(TargetFrameworkModern.Identity) in $(BinaryZipPackageDirectory)\lib\%(TargetFrameworkModern.Moniker)." Condition="!Exists('$(BinaryZipPackageDirectory)\lib\%(TargetFrameworkModern.Moniker)\Renci.SshNet.xml')"/>
</Target>
<Target Name="CreateNuGetPackage" DependsOnTargets="ValidatePackage;CheckNuGetPackageDirectory;CheckReleaseVersion">
<Exec Command="$(NuGetExe) pack $(MSBuildThisFileDirectory)nuget\SSH.NET.nuspec -OutputDirectory &quot;$(MSBuildThisFileDirectory)target&quot; -Version &quot;$(ReleaseVersion)&quot; -Properties &quot;copyright=2012-$([System.DateTime]::Now.Year), RENCI&quot; -BasePath &quot;$(NuGetPackageDirectory)&quot; -NonInteractive"/>
</Target>
<Target Name="GenerateHelpFile" DependsOnTargets="CheckReleaseVersion">
<Error Text="Please install Sandcastle, and ensure the SHFBFolder environment variable is set." Condition="'$(SHFBFolder)'==''"/>
<MSBuild Projects="$(MSBuildThisFileDirectory)sandcastle\SSH.NET.shfbproj"/>
<Move SourceFiles="$(MSBuildThisFileDirectory)target\help\SshNet.Help.chm" DestinationFiles="$(MSBuildThisFileDirectory)target\SSH.NET-$(ReleaseVersion)-help.chm"/>
</Target>
<Target Name="PreparePackageClassic" DependsOnTargets="BuildClassic;CheckNuGetPackageDirectory;CheckBinaryZipPackageDirectory" Outputs="%(TargetFrameworkClassic.Identity)">
<ItemGroup>
<BuildOutput Remove="@(BuildOutput)"/>
<BuildOutput Include="$(MSBuildThisFileDirectory)..\src\%(TargetFrameworkClassic.OutputDirectory)\Renci.SshNet.dll"/>
<BuildOutput Include="$(MSBuildThisFileDirectory)..\src\%(TargetFrameworkClassic.OutputDirectory)\Renci.SshNet.xml"/>
</ItemGroup>
<Copy SourceFiles="@(BuildOutput)" DestinationFolder="$(NuGetPackageDirectory)\lib\%(TargetFrameworkClassic.Moniker)"/>
<Copy SourceFiles="@(BuildOutput)" DestinationFolder="$(BinPackageDirectory)\lib\%(TargetFrameworkClassic.Moniker)"/>
</Target>
<Target Name="PreparePackageModern" DependsOnTargets="BuildModern;CheckNuGetPackageDirectory" Outputs="%(TargetFrameworkModern.Identity)">
<ItemGroup>
<BuildOutput Remove="@(BuildOutput)"/>
<BuildOutput Include="$(MSBuildThisFileDirectory)..\src\%(TargetFrameworkModern.OutputDirectory)\Renci.SshNet.dll"/>
<BuildOutput Include="$(MSBuildThisFileDirectory)..\src\%(TargetFrameworkModern.OutputDirectory)\Renci.SshNet.xml"/>
</ItemGroup>
<Copy SourceFiles="@(BuildOutput)" DestinationFolder="$(NuGetPackageDirectory)\lib\%(TargetFrameworkModern.Moniker)"/>
</Target>
<Target Name="CreateBinPackage" DependsOnTargets="PrepareMSBuildTasksPackage;ValidatePackage;CheckReleaseVersion;CheckBinaryZipPackageDirectory">
<ItemGroup>
<Files Remove="@(Files)"/>
<Files Include="$(MSBuildThisFileDirectory)..\LICENSE"/>
<Files Include="$(MSBuildThisFileDirectory)..\THIRD-PARTY-NOTICES.TXT"/>
</ItemGroup>
<Copy SourceFiles="@(Files)" DestinationFolder="$(BinaryZipPackageDirectory)\%(RecursiveDir)"/>
<ItemGroup>
<Files Remove="@(Files)"/>
<Files Include="$(BinaryZipPackageDirectory)\**"/>
</ItemGroup>
<Zip ZipFileName="$(MSBuildThisFileDirectory)target\SSH.NET-$(ReleaseVersion)-bin.zip" Files="@(Files)" WorkingDirectory="$(BinaryZipPackageDirectory)"/>
</Target>
<Target Name="DownloadNuGet">
<MakeDir Directories="$(MSBuildThisFileDirectory)target\nuget"/>
<DownloadFile
Address="https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
FileName="$(MSBuildThisFileDirectory)target\nuget\nuget.exe"/>
</Target>
<Target Name="RestoreNuGetPackages" DependsOnTargets="DownloadNuGet" Outputs="%(VisualStudioVersion.Identity)">
<Message Text="Restoring nuget packages for '%(VisualStudioVersion.SolutionFile)'..." Importance="High" Condition="'%(VisualStudioVersion.MSBuildToolsVersion)'=='$(MSBuildToolsVersion)' and '%(VisualStudioVersion.NuGetPackageRestore)'=='true'"/>
<Exec Command="$(NuGetExe) restore &quot;%(VisualStudioVersion.SolutionFile)&quot;" Condition="'%(VisualStudioVersion.MSBuildToolsVersion)'=='$(MSBuildToolsVersion)' and '%(VisualStudioVersion.NuGetPackageRestore)'=='true'"/>
</Target>
<Target Name="Build" DependsOnTargets="RestoreNuGetPackages" Outputs="%(VisualStudioVersion.Identity)">
<ItemGroup>
<ProjectToBuild Remove="@(ProjectToBuild)"/>
<ProjectToBuild Include="%(VisualStudioVersion.SolutionFile)" Condition="'%(VisualStudioVersion.MSBuildToolsVersion)'=='$(MSBuildToolsVersion)'">
<Properties>Configuration=Release</Properties>
</ProjectToBuild>
</ItemGroup>
<MSBuild Projects="@(ProjectToBuild)" Targets="Rebuild"/>
</Target>
<Target Name="Package" DependsOnTargets="CreateNuGetPackage;CreateBinPackage;GenerateHelpFile"/>
<Target Name="CreateNuGetPackage" DependsOnTargets="CopyBuildOutputToPackage">
<Exec Command="$(NuGetExe) pack $(MSBuildThisFileDirectory)nuget\SSH.NET.nuspec -OutputDirectory &quot;$(MSBuildThisFileDirectory)target&quot; -BasePath &quot;$(MSBuildThisFileDirectory)target\package&quot; -NonInteractive"/>
</Target>
<Target Name="CopyBuildOutputToPackage" Outputs="%(TargetFramework.Identity)">
<ItemGroup>
<BuildOutput Remove="@(BuildOutput)"/>
<BuildOutput Include="$(MSBuildThisFileDirectory)..\src\%(TargetFramework.OutputDirectory)\Renci.SshNet.dll"/>
<BuildOutput Include="$(MSBuildThisFileDirectory)..\src\%(TargetFramework.OutputDirectory)\Renci.SshNet.xml"/>
</ItemGroup>
<Copy SourceFiles="@(BuildOutput)" DestinationFolder="$(MSBuildThisFileDirectory)target\package\lib\%(TargetFramework.Moniker)"/>
</Target>
<Target Name="GenerateHelpFile" DependsOnTargets="CheckReleaseVersion">
<Error Text="Please install Sandcastle, and ensure the SHFBFolder environment variable is set." Condition="'$(SHFBFolder)'==''"/>
<MSBuild Projects="$(MSBuildThisFileDirectory)sandcastle\SSH.NET.shfbproj"/>
<Move SourceFiles="$(MSBuildThisFileDirectory)target\help\SshNet.Help.chm" DestinationFiles="$(MSBuildThisFileDirectory)target\SSH.NET-$(ReleaseVersion)-help.chm"/>
</Target>
<Target Name="CopyBuildOutputToBin" Outputs="%(TargetFramework.Identity)">
<ItemGroup>
<BuildOutput Remove="@(BuildOutput)"/>
<BuildOutput Include="$(MSBuildThisFileDirectory)..\src\%(TargetFramework.OutputDirectory)\*.dll"/>
<BuildOutput Include="$(MSBuildThisFileDirectory)..\src\%(TargetFramework.OutputDirectory)\*.xml"/>
</ItemGroup>
<Copy SourceFiles="@(BuildOutput)" DestinationFolder="$(MSBuildThisFileDirectory)target\bin\lib\%(TargetFramework.Moniker)"/>
</Target>
<Target Name="CreateBinPackage" DependsOnTargets="PrepareMSBuildTasksPackage;CopyBuildOutputToBin;CheckReleaseVersion">
<ItemGroup>
<Files Remove="@(Files)"/>
<Files Include="$(MSBuildThisFileDirectory)..\LICENSE"/>
</ItemGroup>
<Copy SourceFiles="@(Files)" DestinationFolder="$(MSBuildThisFileDirectory)target\bin\%(RecursiveDir)"/>
<ItemGroup>
<Files Remove="@(Files)"/>
<Files Include="$(MSBuildThisFileDirectory)target\bin\**"/>
</ItemGroup>
<Zip ZipFileName="$(MSBuildThisFileDirectory)target\SSH.NET-$(ReleaseVersion)-bin.zip" Files="@(Files)" WorkingDirectory="$(MSBuildThisFileDirectory)target\bin"/>
</Target>
<Target Name="PrepareMSBuildTasksPackage" DependsOnTargets="DownloadNuGet">
<Exec Command="$(NuGetExe) install $(MSBuildTasksPackageId) -Version $(MSBuildTasksPackageVersion) -OutputDirectory &quot;$(MSBuildThisFileDirectory)target\nuget\packages&quot; -Verbosity quiet"/>
</Target>
<Target Name="CheckReleaseVersion" Condition="'$(ReleaseVersion)'==''">
<Error Text= "Please specify the version number of the release (using the &quot;ReleaseVersion&quot; property)."/>
</Target>
<Target Name="CheckNuGetPackageDirectory" DependsOnTargets="CheckReleaseVersion">
<PropertyGroup>
<NuGetPackageDirectory>$(MSBuildThisFileDirectory)target\nuget-$(ReleaseVersion)</NuGetPackageDirectory>
</PropertyGroup>
</Target>
<Target Name="CheckBinaryZipPackageDirectory" DependsOnTargets="CheckReleaseVersion">
<PropertyGroup>
<BinaryZipPackageDirectory>$(MSBuildThisFileDirectory)target\bin-$(ReleaseVersion)</BinaryZipPackageDirectory>
</PropertyGroup>
</Target>
<UsingTask TaskName="DownloadFile" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<Address ParameterType="System.String" Required="true"/>
+21 -31
View File
@@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>SSH.NET</id>
<version>2016.1.0</version>
<version>$version$</version>
<title>SSH.NET</title>
<authors>Renci</authors>
<owners>olegkap,drieseng</owners>
@@ -10,53 +10,43 @@
<projectUrl>https://github.com/sshnet/SSH.NET/</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>SSH.NET is a Secure Shell (SSH) library for .NET, optimized for parallelism and with broad framework support.</description>
<releaseNotes>https://github.com/sshnet/SSH.NET/releases/tag/2016.1.0</releaseNotes>
<releaseNotes>https://github.com/sshnet/SSH.NET/releases/tag/$version$</releaseNotes>
<summary>A Secure Shell (SSH) library for .NET, optimized for parallelism.</summary>
<copyright>2012-2017, RENCI</copyright>
<copyright>$copyright$</copyright>
<language>en-US</language>
<tags>ssh scp sftp</tags>
<dependencies>
<group targetFramework="net35" />
<group targetFramework="net40" />
<group targetFramework="netstandard1.3">
<dependency id="Microsoft.CSharp" version="4.0.1" />
<dependency id="SshNet.Security.Cryptography" version="[1.2.0]" />
<dependency id="System.Diagnostics.Debug" version="4.0.11" />
<dependency id="System.Diagnostics.Tools" version="4.0.1" />
<dependency id="System.Diagnostics.TraceSource" version="4.0.0" />
<dependency id="System.Globalization" version="4.0.11" />
<dependency id="System.IO" version="4.1.0" />
<dependency id="System.IO.FileSystem" version="4.0.1" />
<dependency id="System.IO.FileSystem.Primitives" version="4.0.1" />
<dependency id="System.Linq" version="4.1.0" />
<dependency id="System.Net.NameResolution" version="4.0.0" />
<dependency id="System.Net.Sockets" version="4.1.0" />
<dependency id="System.Reflection.Extensions" version="4.0.1" />
<dependency id="System.Runtime.Extensions" version="4.1.0" />
<dependency id="System.Security.Cryptography.Algorithms" version="4.2.0" />
<dependency id="System.Text.RegularExpressions" version="4.1.0" />
<dependency id="System.Threading" version="4.0.11" />
<dependency id="System.Threading.Thread" version="4.0.0" />
<dependency id="System.Threading.ThreadPool" version="4.0.10" />
<dependency id="System.Threading.Timer" version="4.0.1" />
<dependency id="System.Xml.XmlDocument" version="4.0.1" />
<dependency id="System.Xml.XPath.XmlDocument" version="4.0.1" />
<dependency id="SshNet.Security.Cryptography" version="[1.3.0]" />
<dependency id="System.Diagnostics.TraceSource" version="4.3.0" />
<dependency id="System.Net.NameResolution" version="4.3.0" />
<dependency id="System.Net.Sockets" version="4.3.0" />
<dependency id="System.Threading.Thread" version="4.3.0" />
<dependency id="System.Threading.ThreadPool" version="4.3.0" />
<dependency id="System.Threading.Timer" version="4.3.0" />
<dependency id="System.Xml.XmlDocument" version="4.3.0" />
<dependency id="System.Xml.XPath.XmlDocument" version="4.3.0" />
</group>
<group targetFramework="netstandard2.0">
<dependency id="SshNet.Security.Cryptography" version="[1.3.0]" />
</group>
<group targetFramework="sl4">
<dependency id="SshNet.Security.Cryptography" version="[1.2.0]" />
<dependency id="SshNet.Security.Cryptography" version="[1.3.0]" />
</group>
<group targetFramework="sl5">
<dependency id="SshNet.Security.Cryptography" version="[1.2.0]" />
<dependency id="SshNet.Security.Cryptography" version="[1.3.0]" />
</group>
<group targetFramework="wp71">
<dependency id="SshNet.Security.Cryptography" version="[1.2.0]" />
<dependency id="SshNet.Security.Cryptography" version="[1.3.0]" />
</group>
<group targetFramework="wp8">
<dependency id="SshNet.Security.Cryptography" version="[1.2.0]" />
<dependency id="SshNet.Security.Cryptography" version="[1.3.0]" />
</group>
<group targetFramework="uap10.0">
<dependency id="SshNet.Security.Cryptography" version="[1.2.0]" />
<dependency id="System.Xml.XPath.XmlDocument" version="4.0.1" />
<dependency id="SshNet.Security.Cryptography" version="[1.3.0]" />
<dependency id="System.Xml.XPath.XmlDocument" version="4.3.0" />
</group>
</dependencies>
</metadata>
+2 -2
View File
@@ -41,8 +41,8 @@
</ComponentConfig>
</ComponentConfigurations>
<DocumentationSources>
<DocumentationSource sourceFile="..\..\src\Renci.SshNet\bin\Release\Renci.SshNet.dll" xmlns="" />
<DocumentationSource sourceFile="..\..\src\Renci.SshNet\bin\Release\Renci.SshNet.xml" xmlns="" />
<DocumentationSource sourceFile="..\..\src\Renci.SshNet\bin\Release\net40\Renci.SshNet.dll" xmlns="" />
<DocumentationSource sourceFile="..\..\src\Renci.SshNet\bin\Release\net40\Renci.SshNet.xml" xmlns="" />
</DocumentationSources>
<MissingTags>Summary, Parameter, Returns, AutoDocumentCtors, TypeParameter, AutoDocumentDispose</MissingTags>
<BuildAssemblerVerbosity>OnlyWarningsAndErrors</BuildAssemblerVerbosity>
+3
View File
@@ -0,0 +1,3 @@
rem vstest.console src\Renci.SshNet.Tests\bin\Debug\net40\Renci.SshNet.Tests.dll "/TestCaseFilter:TestCategory=Gert
vstest.console src\Renci.SshNet.Tests\bin\Debug\net40\Renci.SshNet.Tests.dll /TestCaseFilter:"TestCategory!=integration&TestCategory!=LongRunning"
Binary file not shown.
@@ -1,38 +0,0 @@
using System;
using System.Diagnostics;
using System.Security.Cryptography;
using System.Text;
namespace Renci.SshNet.Common
{
/// <summary>
/// Collection of different extension method specific for .NET 3.5
/// </summary>
internal static partial class Extensions
{
/// <summary>
/// Disposes the specified algorithm.
/// </summary>
/// <param name="algorithm">The algorithm.</param>
[DebuggerNonUserCode]
internal static void Dispose(this HashAlgorithm algorithm)
{
if (algorithm == null)
throw new NullReferenceException();
algorithm.Clear();
}
/// <summary>
/// Clears the contents of the string builder.
/// </summary>
/// <param name="value">
/// The <see cref="StringBuilder"/> to clear.
/// </param>
public static void Clear(this StringBuilder value)
{
value.Length = 0;
value.Capacity = 16;
}
}
}
@@ -1,8 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("SSH.NET .NET 3.5")]
[assembly: Guid("a9698831-4993-469b-81f1-aed4e5379252")]
[assembly: InternalsVisibleTo("Renci.SshNet.Tests.NET35, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f9194e1eb66b7e2575aaee115ee1d27bc100920e7150e43992d6f668f9737de8b9c7ae892b62b8a36dd1d57929ff1541665d101dc476d6e02390846efae7e5186eec409710fdb596e3f83740afef0d4443055937649bc5a773175b61c57615dac0f0fd10f52b52fedf76c17474cc567b3f7a79de95dde842509fb39aaf69c6c2")]
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")]
@@ -1,984 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{DD1C552F-7F48-4269-ABB3-2E4C89B7E43A}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Renci.SshNet</RootNamespace>
<AssemblyName>Renci.SshNet</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG;FEATURE_REGEX_COMPILE;FEATURE_BINARY_SERIALIZATION;FEATURE_RNG_CREATE;FEATURE_SOCKET_SYNC;FEATURE_SOCKET_EAP;FEATURE_SOCKET_APM;FEATURE_SOCKET_SETSOCKETOPTION;FEATURE_SOCKET_POLL;FEATURE_STREAM_APM;FEATURE_DNS_SYNC;FEATURE_THREAD_THREADPOOL;FEATURE_THREAD_SLEEP;FEATURE_HASH_MD5;FEATURE_HASH_SHA1_CREATE;FEATURE_HASH_SHA256_CREATE;FEATURE_HASH_SHA384_CREATE;FEATURE_HASH_SHA512_CREATE;FEATURE_HASH_RIPEMD160_CREATE;FEATURE_HMAC_MD5;FEATURE_HMAC_SHA1;FEATURE_HMAC_SHA256;FEATURE_HMAC_SHA384;FEATURE_HMAC_SHA512;FEATURE_HMAC_RIPEMD160;FEATURE_MEMORYSTREAM_GETBUFFER;FEATURE_DIAGNOSTICS_TRACESOURCE;FEATURE_ENCODING_ASCII</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<DocumentationFile>bin\Debug\Renci.SshNet.xml</DocumentationFile>
<LangVersion>5</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;FEATURE_REGEX_COMPILE;FEATURE_BINARY_SERIALIZATION;FEATURE_RNG_CREATE;FEATURE_SOCKET_SYNC;FEATURE_SOCKET_EAP;FEATURE_SOCKET_APM;FEATURE_SOCKET_SETSOCKETOPTION;FEATURE_SOCKET_POLL;FEATURE_STREAM_APM;FEATURE_DNS_SYNC;FEATURE_THREAD_THREADPOOL;FEATURE_THREAD_SLEEP;FEATURE_HASH_MD5;FEATURE_HASH_SHA1_CREATE;FEATURE_HASH_SHA256_CREATE;FEATURE_HASH_SHA384_CREATE;FEATURE_HASH_SHA512_CREATE;FEATURE_HASH_RIPEMD160_CREATE;FEATURE_HMAC_MD5;FEATURE_HMAC_SHA1;FEATURE_HMAC_SHA256;FEATURE_HMAC_SHA384;FEATURE_HMAC_SHA512;FEATURE_HMAC_RIPEMD160;FEATURE_MEMORYSTREAM_GETBUFFER;FEATURE_DIAGNOSTICS_TRACESOURCE;FEATURE_ENCODING_ASCII</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\Renci.SshNet.xml</DocumentationFile>
<NoWarn>
</NoWarn>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<LangVersion>5</LangVersion>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>..\Renci.SshNet.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Renci.SshNet\Abstractions\CryptoAbstraction.cs">
<Link>Abstractions\CryptoAbstraction.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Abstractions\DiagnosticAbstraction.cs">
<Link>Abstractions\DiagnosticAbstraction.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Abstractions\DnsAbstraction.cs">
<Link>Abstractions\DnsAbstraction.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Abstractions\FileSystemAbstraction.cs">
<Link>Abstractions\FileSystemAbstraction.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Abstractions\ReflectionAbstraction.cs">
<Link>Abstractions\ReflectionAbstraction.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Abstractions\SocketAbstraction.cs">
<Link>Abstractions\SocketAbstraction.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Abstractions\ThreadAbstraction.cs">
<Link>Abstractions\ThreadAbstraction.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\AuthenticationMethod.cs">
<Link>AuthenticationMethod.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\AuthenticationResult.cs">
<Link>AuthenticationResult.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\BaseClient.cs">
<Link>BaseClient.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Channels\Channel.cs">
<Link>Channels\Channel.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Channels\ChannelDirectTcpip.cs">
<Link>Channels\ChannelDirectTcpip.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Channels\ChannelForwardedTcpip.cs">
<Link>Channels\ChannelForwardedTcpip.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Channels\ChannelSession.cs">
<Link>Channels\ChannelSession.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Channels\ChannelTypes.cs">
<Link>Channels\ChannelTypes.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Channels\ClientChannel.cs">
<Link>Channels\ClientChannel.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Channels\IChannel.cs">
<Link>Channels\IChannel.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Channels\IChannelDirectTcpip.cs">
<Link>Channels\IChannelDirectTcpip.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Channels\IChannelForwardedTcpip.cs">
<Link>Channels\IChannelForwardedTcpip.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Channels\IChannelSession.cs">
<Link>Channels\IChannelSession.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Channels\ServerChannel.cs">
<Link>Channels\ServerChannel.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\CipherInfo.cs">
<Link>CipherInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\ClientAuthentication.cs">
<Link>ClientAuthentication.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\CommandAsyncResult.cs">
<Link>CommandAsyncResult.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\Array.cs">
<Link>Common\Array.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\ASCIIEncoding.cs">
<Link>Common\ASCIIEncoding.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\AsyncResult.cs">
<Link>Common\AsyncResult.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\AuthenticationBannerEventArgs.cs">
<Link>Common\AuthenticationBannerEventArgs.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\AuthenticationEventArgs.cs">
<Link>Common\AuthenticationEventArgs.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\AuthenticationPasswordChangeEventArgs.cs">
<Link>Common\AuthenticationPasswordChangeEventArgs.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\AuthenticationPrompt.cs">
<Link>Common\AuthenticationPrompt.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\AuthenticationPromptEventArgs.cs">
<Link>Common\AuthenticationPromptEventArgs.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\BigInteger.cs">
<Link>Common\BigInteger.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\ChannelDataEventArgs.cs">
<Link>Common\ChannelDataEventArgs.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\ChannelEventArgs.cs">
<Link>Common\ChannelEventArgs.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\ChannelExtendedDataEventArgs.cs">
<Link>Common\ChannelExtendedDataEventArgs.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\ChannelOpenConfirmedEventArgs.cs">
<Link>Common\ChannelOpenConfirmedEventArgs.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\ChannelOpenFailedEventArgs.cs">
<Link>Common\ChannelOpenFailedEventArgs.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\ChannelRequestEventArgs.cs">
<Link>Common\ChannelRequestEventArgs.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\CountdownEvent.cs">
<Link>Common\CountdownEvent.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\DerData.cs">
<Link>Common\DerData.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\ExceptionEventArgs.cs">
<Link>Common\ExceptionEventArgs.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\Extensions.cs">
<Link>Common\Extensions.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\HostKeyEventArgs.cs">
<Link>Common\HostKeyEventArgs.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\NetConfServerException.cs">
<Link>Common\NetConfServerException.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\ObjectIdentifier.cs">
<Link>Common\ObjectIdentifier.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\Pack.cs">
<Link>Common\Pack.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\PipeStream.cs">
<Link>Common\PipeStream.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\PortForwardEventArgs.cs">
<Link>Common\PortForwardEventArgs.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\PosixPath.cs">
<Link>Common\PosixPath.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\ProxyException.cs">
<Link>Common\ProxyException.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\ScpDownloadEventArgs.cs">
<Link>Common\ScpDownloadEventArgs.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\ScpException.cs">
<Link>Common\ScpException.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\ScpUploadEventArgs.cs">
<Link>Common\ScpUploadEventArgs.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\SemaphoreLight.cs">
<Link>Common\SemaphoreLight.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\SftpPathNotFoundException.cs">
<Link>Common\SftpPathNotFoundException.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\SftpPermissionDeniedException.cs">
<Link>Common\SftpPermissionDeniedException.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\ShellDataEventArgs.cs">
<Link>Common\ShellDataEventArgs.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\SshAuthenticationException.cs">
<Link>Common\SshAuthenticationException.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\SshConnectionException.cs">
<Link>Common\SshConnectionException.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\SshData.cs">
<Link>Common\SshData.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\SshDataStream.cs">
<Link>Common\SshDataStream.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\SshException.cs">
<Link>Common\SshException.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\SshOperationTimeoutException.cs">
<Link>Common\SshOperationTimeoutException.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\SshPassPhraseNullOrEmptyException.cs">
<Link>Common\SshPassPhraseNullOrEmptyException.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\TerminalModes.cs">
<Link>Common\TerminalModes.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Compression\CompressionMode.cs">
<Link>Compression\CompressionMode.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Compression\Compressor.cs">
<Link>Compression\Compressor.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Compression\Zlib.cs">
<Link>Compression\Zlib.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Compression\ZlibOpenSsh.cs">
<Link>Compression\ZlibOpenSsh.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Compression\ZlibStream.cs">
<Link>Compression\ZlibStream.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\ConnectionInfo.cs">
<Link>ConnectionInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\ExpectAction.cs">
<Link>ExpectAction.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\ExpectAsyncResult.cs">
<Link>ExpectAsyncResult.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\ForwardedPort.cs">
<Link>ForwardedPort.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\ForwardedPortDynamic.cs">
<Link>ForwardedPortDynamic.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\ForwardedPortDynamic.NET.cs">
<Link>ForwardedPortDynamic.NET.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\ForwardedPortLocal.cs">
<Link>ForwardedPortLocal.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\ForwardedPortLocal.NET.cs">
<Link>ForwardedPortLocal.NET.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\ForwardedPortRemote.cs">
<Link>ForwardedPortRemote.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\ForwardedPortStatus.cs">
<Link>ForwardedPortStatus.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\HashInfo.cs">
<Link>HashInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\IAuthenticationMethod.cs">
<Link>IAuthenticationMethod.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\IClientAuthentication.cs">
<Link>IClientAuthentication.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\IConnectionInfo.cs">
<Link>IConnectionInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\IForwardedPort.cs">
<Link>IForwardedPort.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\IRemotePathTransformation.cs">
<Link>IRemotePathTransformation.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\IServiceFactory.cs">
<Link>IServiceFactory.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\IServiceFactory.NET.cs">
<Link>IServiceFactory.NET.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\ISession.cs">
<Link>ISession.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\ISubsystemSession.cs">
<Link>ISubsystemSession.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\KeyboardInteractiveAuthenticationMethod.cs">
<Link>KeyboardInteractiveAuthenticationMethod.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\KeyboardInteractiveConnectionInfo.cs">
<Link>KeyboardInteractiveConnectionInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\MessageEventArgs.cs">
<Link>MessageEventArgs.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Authentication\BannerMessage.cs">
<Link>Messages\Authentication\BannerMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Authentication\FailureMessage.cs">
<Link>Messages\Authentication\FailureMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Authentication\InformationRequestMessage.cs">
<Link>Messages\Authentication\InformationRequestMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Authentication\InformationResponseMessage.cs">
<Link>Messages\Authentication\InformationResponseMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Authentication\PasswordChangeRequiredMessage.cs">
<Link>Messages\Authentication\PasswordChangeRequiredMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Authentication\PublicKeyMessage.cs">
<Link>Messages\Authentication\PublicKeyMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Authentication\RequestMessage.cs">
<Link>Messages\Authentication\RequestMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Authentication\RequestMessageHost.cs">
<Link>Messages\Authentication\RequestMessageHost.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Authentication\RequestMessageKeyboardInteractive.cs">
<Link>Messages\Authentication\RequestMessageKeyboardInteractive.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Authentication\RequestMessageNone.cs">
<Link>Messages\Authentication\RequestMessageNone.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Authentication\RequestMessagePassword.cs">
<Link>Messages\Authentication\RequestMessagePassword.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Authentication\RequestMessagePublicKey.cs">
<Link>Messages\Authentication\RequestMessagePublicKey.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Authentication\SuccessMessage.cs">
<Link>Messages\Authentication\SuccessMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\CancelTcpIpForwardGlobalRequestMessage.cs">
<Link>Messages\Connection\CancelTcpIpForwardGlobalRequestMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelCloseMessage.cs">
<Link>Messages\Connection\ChannelCloseMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelDataMessage.cs">
<Link>Messages\Connection\ChannelDataMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelEofMessage.cs">
<Link>Messages\Connection\ChannelEofMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelExtendedDataMessage.cs">
<Link>Messages\Connection\ChannelExtendedDataMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelFailureMessage.cs">
<Link>Messages\Connection\ChannelFailureMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelMessage.cs">
<Link>Messages\Connection\ChannelMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelOpenConfirmationMessage.cs">
<Link>Messages\Connection\ChannelOpenConfirmationMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelOpenFailureMessage.cs">
<Link>Messages\Connection\ChannelOpenFailureMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelOpenFailureReasons.cs">
<Link>Messages\Connection\ChannelOpenFailureReasons.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelOpen\ChannelOpenInfo.cs">
<Link>Messages\Connection\ChannelOpen\ChannelOpenInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelOpen\ChannelOpenMessage.cs">
<Link>Messages\Connection\ChannelOpen\ChannelOpenMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelOpen\DirectTcpipChannelInfo.cs">
<Link>Messages\Connection\ChannelOpen\DirectTcpipChannelInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelOpen\ForwardedTcpipChannelInfo.cs">
<Link>Messages\Connection\ChannelOpen\ForwardedTcpipChannelInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelOpen\SessionChannelOpenInfo.cs">
<Link>Messages\Connection\ChannelOpen\SessionChannelOpenInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelOpen\X11ChannelOpenInfo.cs">
<Link>Messages\Connection\ChannelOpen\X11ChannelOpenInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelRequest\BreakRequestInfo.cs">
<Link>Messages\Connection\ChannelRequest\BreakRequestInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelRequest\ChannelRequestMessage.cs">
<Link>Messages\Connection\ChannelRequest\ChannelRequestMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelRequest\EndOfWriteRequestInfo.cs">
<Link>Messages\Connection\ChannelRequest\EndOfWriteRequestInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelRequest\EnvironmentVariableRequestInfo.cs">
<Link>Messages\Connection\ChannelRequest\EnvironmentVariableRequestInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelRequest\ExecRequestInfo.cs">
<Link>Messages\Connection\ChannelRequest\ExecRequestInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelRequest\ExitSignalRequestInfo.cs">
<Link>Messages\Connection\ChannelRequest\ExitSignalRequestInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelRequest\ExitStatusRequestInfo.cs">
<Link>Messages\Connection\ChannelRequest\ExitStatusRequestInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelRequest\KeepAliveRequestInfo.cs">
<Link>Messages\Connection\ChannelRequest\KeepAliveRequestInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelRequest\PseudoTerminalInfo.cs">
<Link>Messages\Connection\ChannelRequest\PseudoTerminalInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelRequest\RequestInfo.cs">
<Link>Messages\Connection\ChannelRequest\RequestInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelRequest\ShellRequestInfo.cs">
<Link>Messages\Connection\ChannelRequest\ShellRequestInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelRequest\SignalRequestInfo.cs">
<Link>Messages\Connection\ChannelRequest\SignalRequestInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelRequest\SubsystemRequestInfo.cs">
<Link>Messages\Connection\ChannelRequest\SubsystemRequestInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelRequest\WindowChangeRequestInfo.cs">
<Link>Messages\Connection\ChannelRequest\WindowChangeRequestInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelRequest\X11ForwardingRequestInfo.cs">
<Link>Messages\Connection\ChannelRequest\X11ForwardingRequestInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelRequest\XonXoffRequestInfo.cs">
<Link>Messages\Connection\ChannelRequest\XonXoffRequestInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelSuccessMessage.cs">
<Link>Messages\Connection\ChannelSuccessMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\ChannelWindowAdjustMessage.cs">
<Link>Messages\Connection\ChannelWindowAdjustMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\GlobalRequestMessage.cs">
<Link>Messages\Connection\GlobalRequestMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\GlobalRequestName.cs">
<Link>Messages\Connection\GlobalRequestName.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\RequestFailureMessage.cs">
<Link>Messages\Connection\RequestFailureMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\RequestSuccessMessage.cs">
<Link>Messages\Connection\RequestSuccessMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Connection\TcpIpForwardGlobalRequestMessage.cs">
<Link>Messages\Connection\TcpIpForwardGlobalRequestMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Message.cs">
<Link>Messages\Message.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\MessageAttribute.cs">
<Link>Messages\MessageAttribute.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\ServiceName.cs">
<Link>Messages\ServiceName.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Transport\DebugMessage.cs">
<Link>Messages\Transport\DebugMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Transport\DisconnectMessage.cs">
<Link>Messages\Transport\DisconnectMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Transport\DisconnectReason.cs">
<Link>Messages\Transport\DisconnectReason.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Transport\IgnoreMessage.cs">
<Link>Messages\Transport\IgnoreMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Transport\IKeyExchangedAllowed.cs">
<Link>Messages\Transport\IKeyExchangedAllowed.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Transport\KeyExchangeDhGroupExchangeGroup.cs">
<Link>Messages\Transport\KeyExchangeDhGroupExchangeGroup.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Transport\KeyExchangeDhGroupExchangeInit.cs">
<Link>Messages\Transport\KeyExchangeDhGroupExchangeInit.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Transport\KeyExchangeDhGroupExchangeReply.cs">
<Link>Messages\Transport\KeyExchangeDhGroupExchangeReply.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Transport\KeyExchangeDhGroupExchangeRequest.cs">
<Link>Messages\Transport\KeyExchangeDhGroupExchangeRequest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Transport\KeyExchangeDhInitMessage.cs">
<Link>Messages\Transport\KeyExchangeDhInitMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Transport\KeyExchangeDhReplyMessage.cs">
<Link>Messages\Transport\KeyExchangeDhReplyMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Transport\KeyExchangeEcdhInitMessage.cs">
<Link>Messages\Transport\KeyExchangeEcdhInitMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Transport\KeyExchangeEcdhReplyMessage.cs">
<Link>Messages\Transport\KeyExchangeEcdhReplyMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Transport\KeyExchangeInitMessage.cs">
<Link>Messages\Transport\KeyExchangeInitMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Transport\NewKeysMessage.cs">
<Link>Messages\Transport\NewKeysMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Transport\ServiceAcceptMessage.cs">
<Link>Messages\Transport\ServiceAcceptMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Transport\ServiceRequestMessage.cs">
<Link>Messages\Transport\ServiceRequestMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Messages\Transport\UnimplementedMessage.cs">
<Link>Messages\Transport\UnimplementedMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\NetConfClient.cs">
<Link>NetConfClient.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Netconf\INetConfSession.cs">
<Link>Netconf\INetConfSession.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Netconf\NetConfSession.cs">
<Link>Netconf\NetConfSession.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\NoneAuthenticationMethod.cs">
<Link>NoneAuthenticationMethod.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\PasswordAuthenticationMethod.cs">
<Link>PasswordAuthenticationMethod.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\PasswordConnectionInfo.cs">
<Link>PasswordConnectionInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\PrivateKeyAuthenticationMethod.cs">
<Link>PrivateKeyAuthenticationMethod.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\PrivateKeyConnectionInfo.cs">
<Link>PrivateKeyConnectionInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\PrivateKeyFile.cs">
<Link>PrivateKeyFile.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\ProxyTypes.cs">
<Link>ProxyTypes.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\RemotePathDoubleQuoteTransformation.cs">
<Link>RemotePathDoubleQuoteTransformation.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\RemotePathNoneTransformation.cs">
<Link>RemotePathNoneTransformation.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\RemotePathShellQuoteTransformation.cs">
<Link>RemotePathShellQuoteTransformation.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\RemotePathTransformation.cs">
<Link>RemotePathTransformation.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\ScpClient.cs">
<Link>ScpClient.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\ScpClient.NET.cs">
<Link>ScpClient.NET.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Algorithm.cs">
<Link>Security\Algorithm.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\CertificateHostAlgorithm.cs">
<Link>Security\CertificateHostAlgorithm.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\AsymmetricCipher.cs">
<Link>Security\Cryptography\AsymmetricCipher.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\BlockCipher.cs">
<Link>Security\Cryptography\BlockCipher.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\Cipher.cs">
<Link>Security\Cryptography\Cipher.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\CipherDigitalSignature.cs">
<Link>Security\Cryptography\CipherDigitalSignature.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\Ciphers\AesCipher.cs">
<Link>Security\Cryptography\Ciphers\AesCipher.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\Ciphers\Arc4Cipher.cs">
<Link>Security\Cryptography\Ciphers\Arc4Cipher.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\Ciphers\BlowfishCipher.cs">
<Link>Security\Cryptography\Ciphers\BlowfishCipher.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\Ciphers\CastCipher.cs">
<Link>Security\Cryptography\Ciphers\CastCipher.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\Ciphers\CipherMode.cs">
<Link>Security\Cryptography\Ciphers\CipherMode.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\Ciphers\CipherPadding.cs">
<Link>Security\Cryptography\Ciphers\CipherPadding.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\Ciphers\DesCipher.cs">
<Link>Security\Cryptography\Ciphers\DesCipher.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\Ciphers\Modes\CbcCipherMode.cs">
<Link>Security\Cryptography\Ciphers\Modes\CbcCipherMode.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\Ciphers\Modes\CfbCipherMode.cs">
<Link>Security\Cryptography\Ciphers\Modes\CfbCipherMode.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\Ciphers\Modes\CtrCipherMode.cs">
<Link>Security\Cryptography\Ciphers\Modes\CtrCipherMode.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\Ciphers\Modes\OfbCipherMode.cs">
<Link>Security\Cryptography\Ciphers\Modes\OfbCipherMode.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\Ciphers\Paddings\PKCS5Padding.cs">
<Link>Security\Cryptography\Ciphers\Paddings\PKCS5Padding.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\Ciphers\Paddings\PKCS7Padding.cs">
<Link>Security\Cryptography\Ciphers\Paddings\PKCS7Padding.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\Ciphers\RsaCipher.cs">
<Link>Security\Cryptography\Ciphers\RsaCipher.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\Ciphers\SerpentCipher.cs">
<Link>Security\Cryptography\Ciphers\SerpentCipher.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\Ciphers\TripleDesCipher.cs">
<Link>Security\Cryptography\Ciphers\TripleDesCipher.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\Ciphers\TwofishCipher.cs">
<Link>Security\Cryptography\Ciphers\TwofishCipher.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\DigitalSignature.cs">
<Link>Security\Cryptography\DigitalSignature.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\DsaDigitalSignature.cs">
<Link>Security\Cryptography\DsaDigitalSignature.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\DsaKey.cs">
<Link>Security\Cryptography\DsaKey.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\HMACMD5.cs">
<Link>Security\Cryptography\HMACMD5.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\HMACSHA1.cs">
<Link>Security\Cryptography\HMACSHA1.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\HMACSHA256.cs">
<Link>Security\Cryptography\HMACSHA256.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\HMACSHA384.cs">
<Link>Security\Cryptography\HMACSHA384.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\HMACSHA512.cs">
<Link>Security\Cryptography\HMACSHA512.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\Key.cs">
<Link>Security\Cryptography\Key.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\RsaDigitalSignature.cs">
<Link>Security\Cryptography\RsaDigitalSignature.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\RsaKey.cs">
<Link>Security\Cryptography\RsaKey.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\StreamCipher.cs">
<Link>Security\Cryptography\StreamCipher.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\SymmetricCipher.cs">
<Link>Security\Cryptography\SymmetricCipher.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\GroupExchangeHashData.cs">
<Link>Security\GroupExchangeHashData.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\HostAlgorithm.cs">
<Link>Security\HostAlgorithm.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\IKeyExchange.cs">
<Link>Security\IKeyExchange.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\KeyExchange.cs">
<Link>Security\KeyExchange.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\KeyExchangeDiffieHellman.cs">
<Link>Security\KeyExchangeDiffieHellman.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\KeyExchangeDiffieHellmanGroup14Sha1.cs">
<Link>Security\KeyExchangeDiffieHellmanGroup14Sha1.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\KeyExchangeDiffieHellmanGroup1Sha1.cs">
<Link>Security\KeyExchangeDiffieHellmanGroup1Sha1.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\KeyExchangeDiffieHellmanGroupExchangeSha1.cs">
<Link>Security\KeyExchangeDiffieHellmanGroupExchangeSha1.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\KeyExchangeDiffieHellmanGroupExchangeSha256.cs">
<Link>Security\KeyExchangeDiffieHellmanGroupExchangeSha256.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\KeyExchangeDiffieHellmanGroupExchangeShaBase.cs">
<Link>Security\KeyExchangeDiffieHellmanGroupExchangeShaBase.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\KeyExchangeDiffieHellmanGroupSha1.cs">
<Link>Security\KeyExchangeDiffieHellmanGroupSha1.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\KeyHostAlgorithm.cs">
<Link>Security\KeyHostAlgorithm.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\ServiceFactory.cs">
<Link>ServiceFactory.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\ServiceFactory.NET.cs">
<Link>ServiceFactory.NET.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Session.cs">
<Link>Session.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\SftpClient.cs">
<Link>SftpClient.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Flags.cs">
<Link>Sftp\Flags.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\ISftpFileReader.cs">
<Link>Sftp\ISftpFileReader.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\ISftpResponseFactory.cs">
<Link>Sftp\ISftpResponseFactory.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\ISftpSession.cs">
<Link>Sftp\ISftpSession.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Requests\ExtendedRequests\FStatVfsRequest.cs">
<Link>Sftp\Requests\ExtendedRequests\FStatVfsRequest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Requests\ExtendedRequests\HardLinkRequest.cs">
<Link>Sftp\Requests\ExtendedRequests\HardLinkRequest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Requests\ExtendedRequests\PosixRenameRequest.cs">
<Link>Sftp\Requests\ExtendedRequests\PosixRenameRequest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Requests\ExtendedRequests\StatVfsRequest.cs">
<Link>Sftp\Requests\ExtendedRequests\StatVfsRequest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Requests\SftpBlockRequest.cs">
<Link>Sftp\Requests\SftpBlockRequest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Requests\SftpCloseRequest.cs">
<Link>Sftp\Requests\SftpCloseRequest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Requests\SftpExtendedRequest.cs">
<Link>Sftp\Requests\SftpExtendedRequest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Requests\SftpFSetStatRequest.cs">
<Link>Sftp\Requests\SftpFSetStatRequest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Requests\SftpFStatRequest.cs">
<Link>Sftp\Requests\SftpFStatRequest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Requests\SftpInitRequest.cs">
<Link>Sftp\Requests\SftpInitRequest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Requests\SftpLinkRequest.cs">
<Link>Sftp\Requests\SftpLinkRequest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Requests\SftpLStatRequest.cs">
<Link>Sftp\Requests\SftpLStatRequest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Requests\SftpMkDirRequest.cs">
<Link>Sftp\Requests\SftpMkDirRequest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Requests\SftpOpenDirRequest.cs">
<Link>Sftp\Requests\SftpOpenDirRequest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Requests\SftpOpenRequest.cs">
<Link>Sftp\Requests\SftpOpenRequest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Requests\SftpReadDirRequest.cs">
<Link>Sftp\Requests\SftpReadDirRequest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Requests\SftpReadLinkRequest.cs">
<Link>Sftp\Requests\SftpReadLinkRequest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Requests\SftpReadRequest.cs">
<Link>Sftp\Requests\SftpReadRequest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Requests\SftpRealPathRequest.cs">
<Link>Sftp\Requests\SftpRealPathRequest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Requests\SftpRemoveRequest.cs">
<Link>Sftp\Requests\SftpRemoveRequest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Requests\SftpRenameRequest.cs">
<Link>Sftp\Requests\SftpRenameRequest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Requests\SftpRequest.cs">
<Link>Sftp\Requests\SftpRequest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Requests\SftpRmDirRequest.cs">
<Link>Sftp\Requests\SftpRmDirRequest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Requests\SftpSetStatRequest.cs">
<Link>Sftp\Requests\SftpSetStatRequest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Requests\SftpStatRequest.cs">
<Link>Sftp\Requests\SftpStatRequest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Requests\SftpSymLinkRequest.cs">
<Link>Sftp\Requests\SftpSymLinkRequest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Requests\SftpUnblockRequest.cs">
<Link>Sftp\Requests\SftpUnblockRequest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Requests\SftpWriteRequest.cs">
<Link>Sftp\Requests\SftpWriteRequest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Responses\ExtendedReplies\ExtendedReplyInfo.cs">
<Link>Sftp\Responses\ExtendedReplies\ExtendedReplyInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Responses\ExtendedReplies\StatVfsReplyInfo.cs">
<Link>Sftp\Responses\ExtendedReplies\StatVfsReplyInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Responses\SftpAttrsResponse.cs">
<Link>Sftp\Responses\SftpAttrsResponse.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Responses\SftpDataResponse.cs">
<Link>Sftp\Responses\SftpDataResponse.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Responses\SftpExtendedReplyResponse.cs">
<Link>Sftp\Responses\SftpExtendedReplyResponse.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Responses\SftpHandleResponse.cs">
<Link>Sftp\Responses\SftpHandleResponse.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Responses\SftpNameResponse.cs">
<Link>Sftp\Responses\SftpNameResponse.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Responses\SftpResponse.cs">
<Link>Sftp\Responses\SftpResponse.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Responses\SftpStatusResponse.cs">
<Link>Sftp\Responses\SftpStatusResponse.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\Responses\SftpVersionResponse.cs">
<Link>Sftp\Responses\SftpVersionResponse.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\SftpCloseAsyncResult.cs">
<Link>Sftp\SftpCloseAsyncResult.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\SftpDownloadAsyncResult.cs">
<Link>Sftp\SftpDownloadAsyncResult.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\SftpFile.cs">
<Link>Sftp\SftpFile.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\SftpFileAttributes.cs">
<Link>Sftp\SftpFileAttributes.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\SftpFileReader.cs">
<Link>Sftp\SftpFileReader.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\SftpFileStream.cs">
<Link>Sftp\SftpFileStream.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\SftpFileSystemInformation.cs">
<Link>Sftp\SftpFileSystemInformation.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\SftpListDirectoryAsyncResult.cs">
<Link>Sftp\SftpListDirectoryAsyncResult.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\SftpMessage.cs">
<Link>Sftp\SftpMessage.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\SftpMessageTypes.cs">
<Link>Sftp\SftpMessageTypes.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\SftpOpenAsyncResult.cs">
<Link>Sftp\SftpOpenAsyncResult.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\SftpReadAsyncResult.cs">
<Link>Sftp\SftpReadAsyncResult.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\SftpRealPathAsyncResult.cs">
<Link>Sftp\SftpRealPathAsyncResult.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\SftpResponseFactory.cs">
<Link>Sftp\SftpResponseFactory.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\SftpSession.cs">
<Link>Sftp\SftpSession.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\SFtpStatAsyncResult.cs">
<Link>Sftp\SFtpStatAsyncResult.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\SftpSynchronizeDirectoriesAsyncResult.cs">
<Link>Sftp\SftpSynchronizeDirectoriesAsyncResult.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\SftpUploadAsyncResult.cs">
<Link>Sftp\SftpUploadAsyncResult.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Sftp\StatusCodes.cs">
<Link>Sftp\StatusCodes.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Shell.cs">
<Link>Shell.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\ShellStream.cs">
<Link>ShellStream.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\SshClient.cs">
<Link>SshClient.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\SshCommand.cs">
<Link>SshCommand.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\SshMessageFactory.cs">
<Link>SshMessageFactory.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\SubsystemSession.cs">
<Link>SubsystemSession.cs</Link>
</Compile>
<Compile Include="Common\Extensions.NET35.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="..\Renci.SshNet\Properties\CommonAssemblyInfo.cs">
<Link>Properties\CommonAssemblyInfo.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<None Include="..\Renci.SshNet.snk">
<Link>Renci.SshNet.snk</Link>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
<UserProperties ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" ProjectLinkReference="2f5f8c90-0bd1-424f-997c-7bc6280919d1" />
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
@@ -1,3 +0,0 @@
using System.Reflection;
[assembly: AssemblyTitle("SSH.NET")]
@@ -1,113 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup>
<AssemblyTitle>SSH.NET</AssemblyTitle>
<TargetFramework>netstandard1.3</TargetFramework>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyName>Renci.SshNet</AssemblyName>
<AssemblyOriginatorKeyFile>../Renci.SshNet.snk</AssemblyOriginatorKeyFile>
<LangVersion>5</LangVersion>
<SignAssembly>true</SignAssembly>
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\Renci.SshNet\**\*.cs" Exclude="..\Renci.SshNet\Properties\AssemblyInfo.cs">
<Link>%(RecursiveDir)%(Filename)%(Extension)</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<PackageReference Include="NETStandard.Library">
<Version>1.6.0</Version>
</PackageReference>
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
<PackageReference Include="Microsoft.CSharp">
<Version>4.0.1</Version>
</PackageReference>
<PackageReference Include="SshNet.Security.Cryptography">
<Version>[1.2.0]</Version>
</PackageReference>
<PackageReference Include="System.Diagnostics.Debug">
<Version>4.0.11</Version>
</PackageReference>
<PackageReference Include="System.Diagnostics.Tools">
<Version>4.0.1</Version>
</PackageReference>
<PackageReference Include="System.Diagnostics.TraceSource">
<Version>4.0.0</Version>
</PackageReference>
<PackageReference Include="System.Globalization">
<Version>4.0.11</Version>
</PackageReference>
<PackageReference Include="System.IO">
<Version>4.1.0</Version>
</PackageReference>
<PackageReference Include="System.IO.FileSystem">
<Version>4.0.1</Version>
</PackageReference>
<PackageReference Include="System.IO.FileSystem.Primitives">
<Version>4.0.1</Version>
</PackageReference>
<PackageReference Include="System.Linq">
<Version>4.1.0</Version>
</PackageReference>
<PackageReference Include="System.Net.NameResolution">
<Version>4.0.0</Version>
</PackageReference>
<PackageReference Include="System.Net.Sockets">
<Version>4.1.0</Version>
</PackageReference>
<PackageReference Include="System.Reflection.Extensions">
<Version>4.0.1</Version>
</PackageReference>
<PackageReference Include="System.Runtime.Extensions">
<Version>4.1.0</Version>
</PackageReference>
<PackageReference Include="System.Security.Cryptography.Algorithms">
<Version>4.2.0</Version>
</PackageReference>
<PackageReference Include="System.Text.RegularExpressions">
<Version>4.1.0</Version>
</PackageReference>
<PackageReference Include="System.Threading">
<Version>4.0.11</Version>
</PackageReference>
<PackageReference Include="System.Threading.Thread">
<Version>4.0.0</Version>
</PackageReference>
<PackageReference Include="System.Threading.ThreadPool">
<Version>4.0.10</Version>
</PackageReference>
<PackageReference Include="System.Threading.Timer">
<Version>4.0.1</Version>
</PackageReference>
<PackageReference Include="System.Xml.XmlDocument">
<Version>4.0.1</Version>
</PackageReference>
<PackageReference Include="System.Xml.XPath.XmlDocument">
<Version>4.0.1</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Compile Update="..\Renci.SshNet\Sftp\ISftpMessageFactory.cs" Link="Sftp\ISftpResponseFactory.cs" />
<Compile Update="..\Renci.SshNet\Sftp\SftpMessageFactory.cs" Link="Sftp\SftpResponseFactory.cs" />
</ItemGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
<DefineConstants>FEATURE_ENCODING_ASCII;FEATURE_DIAGNOSTICS_TRACESOURCE;FEATURE_DIRECTORYINFO_ENUMERATEFILES;FEATURE_MEMORYSTREAM_TRYGETBUFFER;FEATURE_REFLECTION_TYPEINFO;FEATURE_RNG_CREATE;FEATURE_SOCKET_TAP;FEATURE_SOCKET_EAP;FEATURE_SOCKET_SYNC;FEATURE_SOCKET_SETSOCKETOPTION;FEATURE_SOCKET_SELECT;FEATURE_SOCKET_POLL;FEATURE_SOCKET_DISPOSE;FEATURE_DNS_TAP;FEATURE_STREAM_TAP;FEATURE_THREAD_COUNTDOWNEVENT;FEATURE_THREAD_THREADPOOL;FEATURE_THREAD_SLEEP;FEATURE_WAITHANDLE_DISPOSE;FEATURE_HASH_MD5;FEATURE_HASH_SHA1_CREATE;FEATURE_HASH_SHA256_CREATE;FEATURE_HASH_SHA384_CREATE;FEATURE_HASH_SHA512_CREATE;FEATURE_HMAC_MD5;FEATURE_HMAC_SHA1;FEATURE_HMAC_SHA256;FEATURE_HMAC_SHA384;FEATURE_HMAC_SHA512</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugType>portable</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugType>none</DebugType>
</PropertyGroup>
</Project>
@@ -1,53 +0,0 @@
using System;
using System.Net.Sockets;
using System.Threading;
using System.Security.Cryptography;
using System.Diagnostics;
namespace Renci.SshNet.Common
{
/// <summary>
/// Collection of different extension method specific for Silverlight
/// </summary>
internal static partial class Extensions
{
/// <summary>
/// Disposes the specified socket.
/// </summary>
/// <param name="socket">The socket.</param>
[DebuggerNonUserCode]
internal static void Dispose(this Socket socket)
{
if (socket == null)
throw new NullReferenceException();
socket.Close();
}
/// <summary>
/// Disposes the specified handle.
/// </summary>
/// <param name="handle">The handle.</param>
[DebuggerNonUserCode]
internal static void Dispose(this WaitHandle handle)
{
if (handle == null)
throw new NullReferenceException();
handle.Close();
}
/// <summary>
/// Disposes the specified algorithm.
/// </summary>
/// <param name="algorithm">The algorithm.</param>
[DebuggerNonUserCode]
internal static void Dispose(this HashAlgorithm algorithm)
{
if (algorithm == null)
throw new NullReferenceException();
algorithm.Clear();
}
}
}
@@ -593,12 +593,411 @@
<Compile Include="..\Renci.SshNet\Security\Algorithm.cs">
<Link>Security\Algorithm.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\asn1\sec\SECNamedCurves.cs">
<Link>Security\Cryptography\BouncyCastle\asn1\sec\SECNamedCurves.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\asn1\x9\X9Curve.cs">
<Link>Security\Cryptography\BouncyCastle\asn1\x9\X9Curve.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\asn1\x9\X9ECParameters.cs">
<Link>Security\Cryptography\BouncyCastle\asn1\x9\X9ECParameters.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\asn1\x9\X9ECParametersHolder.cs">
<Link>Security\Cryptography\BouncyCastle\asn1\x9\X9ECParametersHolder.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\asn1\x9\X9ECPoint.cs">
<Link>Security\Cryptography\BouncyCastle\asn1\x9\X9ECPoint.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\agreement\ECDHCBasicAgreement.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\agreement\ECDHCBasicAgreement.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\AsymmetricCipherKeyPair.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\AsymmetricCipherKeyPair.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\AsymmetricKeyParameter.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\AsymmetricKeyParameter.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\digests\GeneralDigest.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\digests\GeneralDigest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\digests\Sha256Digest.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\digests\Sha256Digest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\generators\ECKeyPairGenerator.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\generators\ECKeyPairGenerator.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\IAsymmetricCipherKeyPairGenerator.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\IAsymmetricCipherKeyPairGenerator.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\IDigest.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\IDigest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\KeyGenerationParameters.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\KeyGenerationParameters.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\parameters\ECDomainParameters.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\parameters\ECDomainParameters.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\parameters\ECKeyGenerationParameters.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\parameters\ECKeyGenerationParameters.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\parameters\ECKeyParameters.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\parameters\ECKeyParameters.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\parameters\ECPrivateKeyParameters.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\parameters\ECPrivateKeyParameters.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\parameters\ECPublicKeyParameters.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\parameters\ECPublicKeyParameters.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\prng\CryptoApiRandomGenerator.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\prng\CryptoApiRandomGenerator.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\prng\DigestRandomGenerator.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\prng\DigestRandomGenerator.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\prng\IRandomGenerator.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\prng\IRandomGenerator.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\util\Pack.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\util\Pack.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\BigInteger.cs">
<Link>Security\Cryptography\BouncyCastle\math\BigInteger.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\abc\SimpleBigDecimal.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\abc\SimpleBigDecimal.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\abc\Tnaf.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\abc\Tnaf.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\abc\ZTauElement.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\abc\ZTauElement.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\ECAlgorithms.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\ECAlgorithms.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\ECCurve.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\ECCurve.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\ECFieldElement.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\ECFieldElement.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\ECLookupTable.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\ECLookupTable.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\ECPoint.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\ECPoint.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\ECPointMap.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\ECPointMap.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\endo\ECEndomorphism.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\endo\ECEndomorphism.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\endo\GlvEndomorphism.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\endo\GlvEndomorphism.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\LongArray.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\LongArray.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\multiplier\AbstractECMultiplier.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\multiplier\AbstractECMultiplier.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\multiplier\ECMultiplier.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\multiplier\ECMultiplier.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\multiplier\FixedPointCombMultiplier.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\multiplier\FixedPointCombMultiplier.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\multiplier\FixedPointPreCompInfo.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\multiplier\FixedPointPreCompInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\multiplier\FixedPointUtilities.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\multiplier\FixedPointUtilities.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\multiplier\GlvMultiplier.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\multiplier\GlvMultiplier.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\multiplier\IPreCompCallback.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\multiplier\IPreCompCallback.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\multiplier\PreCompInfo.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\multiplier\PreCompInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\multiplier\ValidityPreCompInfo.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\multiplier\ValidityPreCompInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\multiplier\WNafL2RMultiplier.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\multiplier\WNafL2RMultiplier.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\multiplier\WNafPreCompInfo.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\multiplier\WNafPreCompInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\multiplier\WNafUtilities.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\multiplier\WNafUtilities.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\multiplier\WTauNafMultiplier.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\multiplier\WTauNafMultiplier.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\multiplier\WTauNafPreCompInfo.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\multiplier\WTauNafPreCompInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\field\FiniteFields.cs">
<Link>Security\Cryptography\BouncyCastle\math\field\FiniteFields.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\field\GenericPolynomialExtensionField.cs">
<Link>Security\Cryptography\BouncyCastle\math\field\GenericPolynomialExtensionField.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\field\GF2Polynomial.cs">
<Link>Security\Cryptography\BouncyCastle\math\field\GF2Polynomial.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\field\IExtensionField.cs">
<Link>Security\Cryptography\BouncyCastle\math\field\IExtensionField.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\field\IFiniteField.cs">
<Link>Security\Cryptography\BouncyCastle\math\field\IFiniteField.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\field\IPolynomial.cs">
<Link>Security\Cryptography\BouncyCastle\math\field\IPolynomial.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\field\IPolynomialExtensionField.cs">
<Link>Security\Cryptography\BouncyCastle\math\field\IPolynomialExtensionField.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\field\PrimeField.cs">
<Link>Security\Cryptography\BouncyCastle\math\field\PrimeField.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\raw\Mod.cs">
<Link>Security\Cryptography\BouncyCastle\math\raw\Mod.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\raw\Nat.cs">
<Link>Security\Cryptography\BouncyCastle\math\raw\Nat.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\security\DigestUtilities.cs">
<Link>Security\Cryptography\BouncyCastle\security\DigestUtilities.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\security\SecureRandom.cs">
<Link>Security\Cryptography\BouncyCastle\security\SecureRandom.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\security\SecurityUtilityException.cs">
<Link>Security\Cryptography\BouncyCastle\security\SecurityUtilityException.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\util\Arrays.cs">
<Link>Security\Cryptography\BouncyCastle\util\Arrays.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\util\BigIntegers.cs">
<Link>Security\Cryptography\BouncyCastle\util\BigIntegers.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\util\encoders\Hex.cs">
<Link>Security\Cryptography\BouncyCastle\util\encoders\Hex.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\util\encoders\HexEncoder.cs">
<Link>Security\Cryptography\BouncyCastle\util\encoders\HexEncoder.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\util\IMemoable.cs">
<Link>Security\Cryptography\BouncyCastle\util\IMemoable.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\util\Integers.cs">
<Link>Security\Cryptography\BouncyCastle\util\Integers.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\util\MemoableResetException.cs">
<Link>Security\Cryptography\BouncyCastle\util\MemoableResetException.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\util\Times.cs">
<Link>Security\Cryptography\BouncyCastle\util\Times.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\CertificateHostAlgorithm.cs">
<Link>Security\CertificateHostAlgorithm.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\CryptoBytes.cs">
<Link>Security\Cryptography\Chaos.NaCl\CryptoBytes.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Ed25519.cs">
<Link>Security\Cryptography\Chaos.NaCl\Ed25519.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Array16.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Array16.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Array8.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Array8.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\ByteIntegerConverter.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\ByteIntegerConverter.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\base.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\base.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\base2.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\base2.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\d.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\d.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\d2.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\d2.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_0.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_0.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_1.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_1.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_add.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_add.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_cmov.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_cmov.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_cswap.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_cswap.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_frombytes.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_frombytes.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_invert.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_invert.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_isnegative.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_isnegative.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_isnonzero.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_isnonzero.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_mul.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_mul.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_mul121666.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_mul121666.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_neg.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_neg.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_pow22523.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_pow22523.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_sq.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_sq.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_sq2.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_sq2.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_sub.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_sub.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_tobytes.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_tobytes.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\FieldElement.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\FieldElement.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_add.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_add.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_double_scalarmult.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_double_scalarmult.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_frombytes.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_frombytes.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_madd.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_madd.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_msub.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_msub.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_p1p1_to_p2.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_p1p1_to_p2.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_p1p1_to_p3.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_p1p1_to_p3.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_p2_0.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_p2_0.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_p2_dbl.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_p2_dbl.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_p3_0.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_p3_0.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_p3_dbl.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_p3_dbl.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_p3_tobytes.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_p3_tobytes.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_p3_to_cached.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_p3_to_cached.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_p3_to_p2.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_p3_to_p2.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_precomp_0.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_precomp_0.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_scalarmult_base.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_scalarmult_base.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_sub.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_sub.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_tobytes.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_tobytes.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\GroupElement.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\GroupElement.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\keypair.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\keypair.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\open.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\open.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\scalarmult.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\scalarmult.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\sc_clamp.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\sc_clamp.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\sc_mul_add.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\sc_mul_add.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\sc_reduce.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\sc_reduce.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\sign.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\sign.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\sqrtm1.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\sqrtm1.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\InternalAssert.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\InternalAssert.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Poly1305Donna.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Poly1305Donna.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Salsa\Salsa20.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Salsa\Salsa20.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Salsa\SalsaCore.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Salsa\SalsaCore.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Sha512Internal.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Sha512Internal.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\MontgomeryCurve25519.cs">
<Link>Security\Cryptography\Chaos.NaCl\MontgomeryCurve25519.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Sha512.cs">
<Link>Security\Cryptography\Chaos.NaCl\Sha512.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\AsymmetricCipher.cs">
<Link>Security\Cryptography\AsymmetricCipher.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\Bcrypt.cs">
<Link>Security\Cryptography\Bcrypt.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\BlockCipher.cs">
<Link>Security\Cryptography\BlockCipher.cs</Link>
</Compile>
@@ -668,6 +1067,12 @@
<Compile Include="..\Renci.SshNet\Security\Cryptography\DsaKey.cs">
<Link>Security\Cryptography\DsaKey.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\ED25519DigitalSignature.cs">
<Link>Security\Cryptography\ED25519DigitalSignature.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\ED25519Key.cs">
<Link>Security\Cryptography\ED25519Key.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\HMACMD5.cs">
<Link>Security\Cryptography\HMACMD5.cs</Link>
</Compile>
@@ -731,6 +1136,24 @@
<Compile Include="..\Renci.SshNet\Security\KeyExchangeDiffieHellmanGroupSha1.cs">
<Link>Security\KeyExchangeDiffieHellmanGroupSha1.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\KeyExchangeEC.cs">
<Link>Security\KeyExchangeEC.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\KeyExchangeECCurve25519.cs">
<Link>Security\KeyExchangeECCurve25519.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\KeyExchangeECDH.cs">
<Link>Security\KeyExchangeECDH.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\KeyExchangeECDH256.cs">
<Link>Security\KeyExchangeECDH256.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\KeyExchangeECDH384.cs">
<Link>Security\KeyExchangeECDH384.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\KeyExchangeECDH521.cs">
<Link>Security\KeyExchangeECDH521.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\KeyHostAlgorithm.cs">
<Link>Security\KeyHostAlgorithm.cs</Link>
</Compile>
@@ -944,7 +1367,6 @@
<Compile Include="..\Renci.SshNet\SubsystemSession.cs">
<Link>SubsystemSession.cs</Link>
</Compile>
<Compile Include="Common\Extensions.SilverlightShared.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="..\Renci.SshNet\Properties\CommonAssemblyInfo.cs">
<Link>Properties\CommonAssemblyInfo.cs</Link>
@@ -29,7 +29,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Bin\Debug</OutputPath>
<DefineConstants>TRACE;DEBUG;FEATURE_DIRECTORYINFO_ENUMERATEFILES;FEATURE_RNG_CSP;FEATURE_SOCKET_EAP;FEATURE_SOCKET_SETSOCKETOPTION;FEATURE_SOCKET_DISPOSE;FEATURE_STREAM_APM;FEATURE_THREAD_THREADPOOL;FEATURE_THREAD_SLEEP;FEATURE_WAITHANDLE_DISPOSE;FEATURE_MEMORYSTREAM_GETBUFFER;FEATURE_HASH_SHA1_MANAGED;FEATURE_HASH_SHA256_MANAGED;FEATURE_HMAC_SHA1;FEATURE_HMAC_SHA256</DefineConstants>
<DefineConstants>TRACE;DEBUG;FEATURE_DIRECTORYINFO_ENUMERATEFILES;FEATURE_RNG_CSP;FEATURE_SOCKET_EAP;FEATURE_SOCKET_DISPOSE;FEATURE_STREAM_APM;FEATURE_THREAD_THREADPOOL;FEATURE_THREAD_SLEEP;FEATURE_WAITHANDLE_DISPOSE;FEATURE_MEMORYSTREAM_GETBUFFER;FEATURE_HASH_SHA1_MANAGED;FEATURE_HASH_SHA256_MANAGED;FEATURE_HMAC_SHA1;FEATURE_HMAC_SHA256</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
@@ -42,7 +42,7 @@
<DebugType>none</DebugType>
<Optimize>true</Optimize>
<OutputPath>Bin\Release</OutputPath>
<DefineConstants>TRACE;FEATURE_DIRECTORYINFO_ENUMERATEFILES;FEATURE_RNG_CSP;FEATURE_SOCKET_EAP;FEATURE_SOCKET_SETSOCKETOPTION;FEATURE_SOCKET_DISPOSE;FEATURE_STREAM_APM;FEATURE_THREAD_THREADPOOL;FEATURE_THREAD_SLEEP;FEATURE_WAITHANDLE_DISPOSE;FEATURE_MEMORYSTREAM_GETBUFFER;FEATURE_HASH_SHA1_MANAGED;FEATURE_HASH_SHA256_MANAGED;FEATURE_HMAC_SHA1;FEATURE_HMAC_SHA256</DefineConstants>
<DefineConstants>TRACE;FEATURE_DIRECTORYINFO_ENUMERATEFILES;FEATURE_RNG_CSP;FEATURE_SOCKET_EAP;FEATURE_SOCKET_DISPOSE;FEATURE_STREAM_APM;FEATURE_THREAD_THREADPOOL;FEATURE_THREAD_SLEEP;FEATURE_WAITHANDLE_DISPOSE;FEATURE_MEMORYSTREAM_GETBUFFER;FEATURE_HASH_SHA1_MANAGED;FEATURE_HASH_SHA256_MANAGED;FEATURE_HMAC_SHA1;FEATURE_HMAC_SHA256</DefineConstants>
<NoStdLib>true</NoStdLib>
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
@@ -200,9 +200,6 @@
<Compile Include="..\Renci.SshNet\Common\Extensions.cs">
<Link>Common\Extensions.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet.Silverlight\Common\Extensions.SilverlightShared.cs">
<Link>Common\Extensions.SilverlightShared.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Common\HostKeyEventArgs.cs">
<Link>Common\HostKeyEventArgs.cs</Link>
</Compile>
@@ -602,12 +599,411 @@
<Compile Include="..\Renci.SshNet\Security\Algorithm.cs">
<Link>Security\Algorithm.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\asn1\sec\SECNamedCurves.cs">
<Link>Security\Cryptography\BouncyCastle\asn1\sec\SECNamedCurves.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\asn1\x9\X9Curve.cs">
<Link>Security\Cryptography\BouncyCastle\asn1\x9\X9Curve.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\asn1\x9\X9ECParameters.cs">
<Link>Security\Cryptography\BouncyCastle\asn1\x9\X9ECParameters.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\asn1\x9\X9ECParametersHolder.cs">
<Link>Security\Cryptography\BouncyCastle\asn1\x9\X9ECParametersHolder.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\asn1\x9\X9ECPoint.cs">
<Link>Security\Cryptography\BouncyCastle\asn1\x9\X9ECPoint.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\agreement\ECDHCBasicAgreement.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\agreement\ECDHCBasicAgreement.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\AsymmetricCipherKeyPair.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\AsymmetricCipherKeyPair.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\AsymmetricKeyParameter.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\AsymmetricKeyParameter.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\digests\GeneralDigest.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\digests\GeneralDigest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\digests\Sha256Digest.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\digests\Sha256Digest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\generators\ECKeyPairGenerator.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\generators\ECKeyPairGenerator.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\IAsymmetricCipherKeyPairGenerator.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\IAsymmetricCipherKeyPairGenerator.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\IDigest.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\IDigest.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\KeyGenerationParameters.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\KeyGenerationParameters.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\parameters\ECDomainParameters.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\parameters\ECDomainParameters.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\parameters\ECKeyGenerationParameters.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\parameters\ECKeyGenerationParameters.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\parameters\ECKeyParameters.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\parameters\ECKeyParameters.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\parameters\ECPrivateKeyParameters.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\parameters\ECPrivateKeyParameters.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\parameters\ECPublicKeyParameters.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\parameters\ECPublicKeyParameters.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\prng\CryptoApiRandomGenerator.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\prng\CryptoApiRandomGenerator.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\prng\DigestRandomGenerator.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\prng\DigestRandomGenerator.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\prng\IRandomGenerator.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\prng\IRandomGenerator.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\crypto\util\Pack.cs">
<Link>Security\Cryptography\BouncyCastle\crypto\util\Pack.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\BigInteger.cs">
<Link>Security\Cryptography\BouncyCastle\math\BigInteger.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\abc\SimpleBigDecimal.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\abc\SimpleBigDecimal.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\abc\Tnaf.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\abc\Tnaf.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\abc\ZTauElement.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\abc\ZTauElement.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\ECAlgorithms.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\ECAlgorithms.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\ECCurve.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\ECCurve.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\ECFieldElement.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\ECFieldElement.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\ECLookupTable.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\ECLookupTable.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\ECPoint.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\ECPoint.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\ECPointMap.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\ECPointMap.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\endo\ECEndomorphism.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\endo\ECEndomorphism.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\endo\GlvEndomorphism.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\endo\GlvEndomorphism.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\LongArray.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\LongArray.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\multiplier\AbstractECMultiplier.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\multiplier\AbstractECMultiplier.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\multiplier\ECMultiplier.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\multiplier\ECMultiplier.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\multiplier\FixedPointCombMultiplier.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\multiplier\FixedPointCombMultiplier.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\multiplier\FixedPointPreCompInfo.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\multiplier\FixedPointPreCompInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\multiplier\FixedPointUtilities.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\multiplier\FixedPointUtilities.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\multiplier\GlvMultiplier.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\multiplier\GlvMultiplier.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\multiplier\IPreCompCallback.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\multiplier\IPreCompCallback.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\multiplier\PreCompInfo.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\multiplier\PreCompInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\multiplier\ValidityPreCompInfo.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\multiplier\ValidityPreCompInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\multiplier\WNafL2RMultiplier.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\multiplier\WNafL2RMultiplier.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\multiplier\WNafPreCompInfo.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\multiplier\WNafPreCompInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\multiplier\WNafUtilities.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\multiplier\WNafUtilities.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\multiplier\WTauNafMultiplier.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\multiplier\WTauNafMultiplier.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\ec\multiplier\WTauNafPreCompInfo.cs">
<Link>Security\Cryptography\BouncyCastle\math\ec\multiplier\WTauNafPreCompInfo.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\field\FiniteFields.cs">
<Link>Security\Cryptography\BouncyCastle\math\field\FiniteFields.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\field\GenericPolynomialExtensionField.cs">
<Link>Security\Cryptography\BouncyCastle\math\field\GenericPolynomialExtensionField.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\field\GF2Polynomial.cs">
<Link>Security\Cryptography\BouncyCastle\math\field\GF2Polynomial.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\field\IExtensionField.cs">
<Link>Security\Cryptography\BouncyCastle\math\field\IExtensionField.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\field\IFiniteField.cs">
<Link>Security\Cryptography\BouncyCastle\math\field\IFiniteField.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\field\IPolynomial.cs">
<Link>Security\Cryptography\BouncyCastle\math\field\IPolynomial.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\field\IPolynomialExtensionField.cs">
<Link>Security\Cryptography\BouncyCastle\math\field\IPolynomialExtensionField.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\field\PrimeField.cs">
<Link>Security\Cryptography\BouncyCastle\math\field\PrimeField.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\raw\Mod.cs">
<Link>Security\Cryptography\BouncyCastle\math\raw\Mod.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\math\raw\Nat.cs">
<Link>Security\Cryptography\BouncyCastle\math\raw\Nat.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\security\DigestUtilities.cs">
<Link>Security\Cryptography\BouncyCastle\security\DigestUtilities.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\security\SecureRandom.cs">
<Link>Security\Cryptography\BouncyCastle\security\SecureRandom.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\security\SecurityUtilityException.cs">
<Link>Security\Cryptography\BouncyCastle\security\SecurityUtilityException.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\util\Arrays.cs">
<Link>Security\Cryptography\BouncyCastle\util\Arrays.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\util\BigIntegers.cs">
<Link>Security\Cryptography\BouncyCastle\util\BigIntegers.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\util\encoders\Hex.cs">
<Link>Security\Cryptography\BouncyCastle\util\encoders\Hex.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\util\encoders\HexEncoder.cs">
<Link>Security\Cryptography\BouncyCastle\util\encoders\HexEncoder.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\util\IMemoable.cs">
<Link>Security\Cryptography\BouncyCastle\util\IMemoable.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\util\Integers.cs">
<Link>Security\Cryptography\BouncyCastle\util\Integers.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\util\MemoableResetException.cs">
<Link>Security\Cryptography\BouncyCastle\util\MemoableResetException.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\BouncyCastle\util\Times.cs">
<Link>Security\Cryptography\BouncyCastle\util\Times.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\CertificateHostAlgorithm.cs">
<Link>Security\CertificateHostAlgorithm.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\CryptoBytes.cs">
<Link>Security\Cryptography\Chaos.NaCl\CryptoBytes.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Ed25519.cs">
<Link>Security\Cryptography\Chaos.NaCl\Ed25519.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Array16.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Array16.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Array8.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Array8.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\ByteIntegerConverter.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\ByteIntegerConverter.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\base.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\base.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\base2.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\base2.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\d.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\d.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\d2.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\d2.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_0.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_0.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_1.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_1.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_add.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_add.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_cmov.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_cmov.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_cswap.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_cswap.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_frombytes.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_frombytes.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_invert.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_invert.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_isnegative.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_isnegative.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_isnonzero.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_isnonzero.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_mul.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_mul.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_mul121666.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_mul121666.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_neg.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_neg.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_pow22523.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_pow22523.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_sq.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_sq.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_sq2.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_sq2.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_sub.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_sub.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\fe_tobytes.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\fe_tobytes.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\FieldElement.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\FieldElement.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_add.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_add.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_double_scalarmult.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_double_scalarmult.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_frombytes.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_frombytes.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_madd.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_madd.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_msub.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_msub.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_p1p1_to_p2.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_p1p1_to_p2.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_p1p1_to_p3.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_p1p1_to_p3.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_p2_0.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_p2_0.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_p2_dbl.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_p2_dbl.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_p3_0.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_p3_0.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_p3_dbl.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_p3_dbl.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_p3_tobytes.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_p3_tobytes.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_p3_to_cached.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_p3_to_cached.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_p3_to_p2.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_p3_to_p2.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_precomp_0.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_precomp_0.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_scalarmult_base.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_scalarmult_base.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_sub.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_sub.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\ge_tobytes.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\ge_tobytes.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\GroupElement.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\GroupElement.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\keypair.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\keypair.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\open.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\open.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\scalarmult.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\scalarmult.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\sc_clamp.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\sc_clamp.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\sc_mul_add.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\sc_mul_add.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\sc_reduce.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\sc_reduce.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\sign.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\sign.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Ed25519Ref10\sqrtm1.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Ed25519Ref10\sqrtm1.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\InternalAssert.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\InternalAssert.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Poly1305Donna.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Poly1305Donna.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Salsa\Salsa20.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Salsa\Salsa20.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Salsa\SalsaCore.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Salsa\SalsaCore.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Internal\Sha512Internal.cs">
<Link>Security\Cryptography\Chaos.NaCl\Internal\Sha512Internal.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\MontgomeryCurve25519.cs">
<Link>Security\Cryptography\Chaos.NaCl\MontgomeryCurve25519.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Chaos.NaCl\Sha512.cs">
<Link>Security\Cryptography\Chaos.NaCl\Sha512.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\AsymmetricCipher.cs">
<Link>Security\Cryptography\AsymmetricCipher.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\Bcrypt.cs">
<Link>Security\Cryptography\Bcrypt.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\BlockCipher.cs">
<Link>Security\Cryptography\BlockCipher.cs</Link>
</Compile>
@@ -677,6 +1073,12 @@
<Compile Include="..\Renci.SshNet\Security\Cryptography\DsaKey.cs">
<Link>Security\Cryptography\DsaKey.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\ED25519DigitalSignature.cs">
<Link>Security\Cryptography\ED25519DigitalSignature.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\ED25519Key.cs">
<Link>Security\Cryptography\ED25519Key.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\Cryptography\HMACMD5.cs">
<Link>Security\Cryptography\HMACMD5.cs</Link>
</Compile>
@@ -740,6 +1142,24 @@
<Compile Include="..\Renci.SshNet\Security\KeyExchangeDiffieHellmanGroupSha1.cs">
<Link>Security\KeyExchangeDiffieHellmanGroupSha1.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\KeyExchangeEC.cs">
<Link>Security\KeyExchangeEC.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\KeyExchangeECCurve25519.cs">
<Link>Security\KeyExchangeECCurve25519.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\KeyExchangeECDH.cs">
<Link>Security\KeyExchangeECDH.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\KeyExchangeECDH256.cs">
<Link>Security\KeyExchangeECDH256.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\KeyExchangeECDH384.cs">
<Link>Security\KeyExchangeECDH384.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\KeyExchangeECDH521.cs">
<Link>Security\KeyExchangeECDH521.cs</Link>
</Compile>
<Compile Include="..\Renci.SshNet\Security\KeyHostAlgorithm.cs">
<Link>Security\KeyHostAlgorithm.cs</Link>
</Compile>
@@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Renci.SshNet.Tests.Common;
namespace Renci.SshNet.Tests.SshClientTests
{
public partial class ForwardedPortLocalTest : TestBase
{
}
}
@@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Renci.SshNet.Tests.Common;
namespace Renci.SshNet.Tests.SshClientTests
{
public partial class ForwardedPortRemoteTest : TestBase
{
}
}
@@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Renci.SshNet.Tests.Common;
namespace Renci.SshNet.Tests.SshClientTests
{
public partial class SshCommandTest : TestBase
{
}
}
@@ -1,5 +0,0 @@
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("SSH.NET Tests .NET 3.5")]
[assembly: Guid("7c827904-40c1-4fe3-8ed1-8a729b8417a9")]
@@ -1,206 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18010
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Renci.SshNet.Tests.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Renci.SshNet.Tests.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to -----BEGIN DSA PRIVATE KEY-----
///Proc-Type: 4,ENCRYPTED
///DEK-Info: DES-EDE3-CBC,053105DCFC6132E7
///
///nVjIhJr3Eeqk0aBfyYK38B6cF0g35U2acgq5t3zG8fCM5JLSnFcmkkYvohbmCLva
///swNHMfmwumoX8Ga94cxGu6vW1qf+IMvgEU4U53DtJqRoeICMwIre1yUq2cCrV+gI
///qQ6MAVMDgfMs7HrPs5999m+KoDh7oYsA1l5q+axU/rqM4g3lySr/1oT6oAQx5Qp2
///2DYkZEwnX5+NTw6aoMXl2qgIHBVxa7wZRMp9L0yAlEFk8T7fMuPrLSAEUBghcIaP
///iBY1OY+M9MgDTTU56ZjLl+DfT3XfKzsZ3fmn1+bLqTRreiuS4/WF6xIa/DQu1sQd
///nnjYgnKYcTWSvWWK9AcIVSpoiW2y6FcPkMAIw54ABrzBp4Rz0//Ykwv2Ga7AZxxm
///P+lkxKf2RWnh406F [rest of string was truncated]&quot;;.
/// </summary>
internal static string DSA_KEY_WITH_PASS {
get {
return ResourceManager.GetString("DSA_KEY_WITH_PASS", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to -----BEGIN DSA PRIVATE KEY-----
///MIIBvAIBAAKBgQDdQrrwGvknwD+pb9Gpv/vDxj8yqFUg0cUuC/tkjm3u+lQj86Rw
///fA8RJOV+OP4Gtvs9zOSsxiuginoB/uEiT+6jbHvyvJeJp2fsDWLx/tVRXxpi8Nwe
///bfb455R0wVVZdqnFKsAZLrQAT589EUtLgyVAFQbUP5Fz6px8H8AG0qlybQIVALn7
///UOxnbFR7fDfZkq2Pc7ZCVegpAoGBANRKf9vezuz1aGUnUGWILHO09SibHK255fkr
///u4//zvCbdawWSZOoU+vMnplLUhNaVMoSyYE/TYOZvvbG9UtPvr8wZGdNPipvIXIB
///xlpr+FH0mnSx0qlaRy3PEoDRAmw6msRCzVYV3vZ8ZTEUdt+phuru+pn0W9EugzCM
///HikVVhJMAoGASHB5nNlWhpqvungn+otYyGKoVoATkRdRfSiUo3fb0mJLTmxrEhEH
///4UOFA/UFdQ0TYXXW0 [rest of string was truncated]&quot;;.
/// </summary>
internal static string DSA_KEY_WITHOUT_PASS {
get {
return ResourceManager.GetString("DSA_KEY_WITHOUT_PASS", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to oleg-centos.edc.renci.org.
/// </summary>
internal static string HOST {
get {
return ResourceManager.GetString("HOST", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to -----BEGIN DSA PRIVATE KEY-----
///MIIBugIBAAKBgQCG3ij/JvdNp+1VUsK2zmLM5QWNN4MRRm/FCOHDknDJrWdSKheO
///h6BbCgyFOw+k5qYtwXQnt3DpQfxPi7PIjr3tQJ9gB8LzqH2DwT2hMXm9VV2ImX2P
///12aj8hZVM99WOp/ma6+ivLSFHnwET19eaqS9SRb0ftIqZXpWGE3ddW07qQIVAOfT
///1OPSsvAnOsSrYc5HG5K3xIWlAoGAAzhTmi29+v0YTIsW2W1FihsexeAnpPPjYgRO
///eT6HreyTvh20UASxDP+IJ2Ba+41G6MU0isuAijp8Z4CCC4RpoS46Ksc3JtPsZiRy
///wAjwlb7JKGRBoY8V3aT47Xyx+iTSclZfzTmv0Z0bb56NZ6KEU8WRnks2d7tsb0fq
///JTAgLkkCgYBvt5EoxhlCwEUgm8j3nD4TLSRYt1lt6LVulBYA9qlV4F68b2cJUuOi
///YTV9H2SWRF6UF+GiR [rest of string was truncated]&quot;;.
/// </summary>
internal static string INVALID_KEY {
get {
return ResourceManager.GetString("INVALID_KEY", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to tester.
/// </summary>
internal static string PASSWORD {
get {
return ResourceManager.GetString("PASSWORD", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 22.
/// </summary>
internal static string PORT {
get {
return ResourceManager.GetString("PORT", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to proxy.oleg-centos.edc.renci.org.
/// </summary>
internal static string PROXY_HOST {
get {
return ResourceManager.GetString("PROXY_HOST", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to 8123.
/// </summary>
internal static string PROXY_PORT {
get {
return ResourceManager.GetString("PROXY_PORT", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to -----BEGIN RSA PRIVATE KEY-----
///Proc-Type: 4,ENCRYPTED
///DEK-Info: DES-EDE3-CBC,B3475536EDD1B442
///
///Xa6Y7FYTfz19CMzPcVbCpBHEh8x3tnA9PutKEDNMwKbR+NVUvBx5fN1QjrLpltCr
///uX7yD3vLCeyihg4oaK3nTBZBcsB/1TZx+MlLgpvMfV1JKmbKCmebBZ3lUpsypHlG
///FpCY41miFwdHmBe6tuwL9XA3vz26eJwSgJGMkVN9EBvNbiOHinEPhSW0whzBfbv+
///OfseG73gvHc4jZS6Sw8h5VDBAmlldJEfkP/s/1/iTbCXFQ22xRb4Z6NilEyKiWpB
///nQviXmaucTWCEuNF5QDA7oV7Ugwm5cAXuBqFIs9ZGaKV4/XpfX1tClOLfB3Lguh+
///bbkwjPb0ztlhKa4gkwXiMs0S/lhoueXBae4QStM0qJBXHtFhhRYIn4JeIZ8CJ0k6
///SMP7QVfPf5aJIaa8 [rest of string was truncated]&quot;;.
/// </summary>
internal static string RSA_KEY_WITH_PASS {
get {
return ResourceManager.GetString("RSA_KEY_WITH_PASS", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to -----BEGIN RSA PRIVATE KEY-----
///MIIEogIBAAKCAQEA8ZsD8jgH7ySXnd4dprEFFkJ+zs1ne81E8febjR8hekiKrc+D
///9GjeEykchy0PsrsBrf2F8J3GtLNISVerkl+EnVh1E0pi9Vllc1vcpQHvBeNPG/jl
///9Dnum/DcaaMKLot+ARXjBuMX/xJVfnlgkvfpBvoq4QzQ6E27rOMbcPlvrN7KeYba
///orsTpDMUraHX5u99P1evvw7sOuNl3lc9YpIgmjHT6dWUGTqBx9T2SEKXBRVk2NNb
///d2UctQkr5BJn1gGehA+1KYS30FMiCSN8F8ZOlpYj1+K6xzs0srq1z30LailIyy7Q
///mYp739BJlOF3cVywdcFXGre35H2cJylcNV2e+QIBIwKCAQAbnK/+bM207j02nQqz
///9vlEX17zECkVdouJXiBn5kz4CEpdAcXwC/wfcmmpDHbSmQeBmVEi0DP3ZPJRhlzA
///RW493jlECIBWjd+1a [rest of string was truncated]&quot;;.
/// </summary>
internal static string RSA_KEY_WITHOUT_PASS {
get {
return ResourceManager.GetString("RSA_KEY_WITHOUT_PASS", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to tester.
/// </summary>
internal static string USERNAME {
get {
return ResourceManager.GetString("USERNAME", resourceCulture);
}
}
}
}
@@ -1,244 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="DSA_KEY_WITHOUT_PASS" xml:space="preserve">
<value>-----BEGIN DSA PRIVATE KEY-----
MIIBvAIBAAKBgQDdQrrwGvknwD+pb9Gpv/vDxj8yqFUg0cUuC/tkjm3u+lQj86Rw
fA8RJOV+OP4Gtvs9zOSsxiuginoB/uEiT+6jbHvyvJeJp2fsDWLx/tVRXxpi8Nwe
bfb455R0wVVZdqnFKsAZLrQAT589EUtLgyVAFQbUP5Fz6px8H8AG0qlybQIVALn7
UOxnbFR7fDfZkq2Pc7ZCVegpAoGBANRKf9vezuz1aGUnUGWILHO09SibHK255fkr
u4//zvCbdawWSZOoU+vMnplLUhNaVMoSyYE/TYOZvvbG9UtPvr8wZGdNPipvIXIB
xlpr+FH0mnSx0qlaRy3PEoDRAmw6msRCzVYV3vZ8ZTEUdt+phuru+pn0W9EugzCM
HikVVhJMAoGASHB5nNlWhpqvungn+otYyGKoVoATkRdRfSiUo3fb0mJLTmxrEhEH
4UOFA/UFdQ0TYXXW0wRX/amynT4iTEXAx0FjxUNK5ryxloeoXiXEH4FK7D8RtJO1
1UsaRrN+nqWiSTVAehl6tzoMCPargGcWeFlAZZnPGN76OD9J1GiKZj8CFQCl8SkF
GWfS+mH8xhLsxh1nI7rfJw==
-----END DSA PRIVATE KEY-----</value>
</data>
<data name="DSA_KEY_WITH_PASS" xml:space="preserve">
<value>-----BEGIN DSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,053105DCFC6132E7
nVjIhJr3Eeqk0aBfyYK38B6cF0g35U2acgq5t3zG8fCM5JLSnFcmkkYvohbmCLva
swNHMfmwumoX8Ga94cxGu6vW1qf+IMvgEU4U53DtJqRoeICMwIre1yUq2cCrV+gI
qQ6MAVMDgfMs7HrPs5999m+KoDh7oYsA1l5q+axU/rqM4g3lySr/1oT6oAQx5Qp2
2DYkZEwnX5+NTw6aoMXl2qgIHBVxa7wZRMp9L0yAlEFk8T7fMuPrLSAEUBghcIaP
iBY1OY+M9MgDTTU56ZjLl+DfT3XfKzsZ3fmn1+bLqTRreiuS4/WF6xIa/DQu1sQd
nnjYgnKYcTWSvWWK9AcIVSpoiW2y6FcPkMAIw54ABrzBp4Rz0//Ykwv2Ga7AZxxm
P+lkxKf2RWnh406FxBvBZzwB3rQeeM7QTg2IcFqGnlf005FIikp6SlyhZ/3M/Nl3
FW235vuO37jLCL8qosGt4NOWAstXaxDujfIb/Q+IYxUpWZrdiH5tM/mUXARK0Sjf
D8DHbFwAT2mUv1QxRXYJO1y4pENboEzT6LUqxJgE+ae/F/29g2RD9DhtwqKqWjhM
7jB0kNVZrz3qUKnoJHIozA==
-----END DSA PRIVATE KEY-----</value>
</data>
<data name="HOST" xml:space="preserve">
<value>oleg-centos.edc.renci.org</value>
</data>
<data name="INVALID_KEY" xml:space="preserve">
<value>-----BEGIN DSA PRIVATE KEY-----
MIIBugIBAAKBgQCG3ij/JvdNp+1VUsK2zmLM5QWNN4MRRm/FCOHDknDJrWdSKheO
h6BbCgyFOw+k5qYtwXQnt3DpQfxPi7PIjr3tQJ9gB8LzqH2DwT2hMXm9VV2ImX2P
12aj8hZVM99WOp/ma6+ivLSFHnwET19eaqS9SRb0ftIqZXpWGE3ddW07qQIVAOfT
1OPSsvAnOsSrYc5HG5K3xIWlAoGAAzhTmi29+v0YTIsW2W1FihsexeAnpPPjYgRO
eT6HreyTvh20UASxDP+IJ2Ba+41G6MU0isuAijp8Z4CCC4RpoS46Ksc3JtPsZiRy
wAjwlb7JKGRBoY8V3aT47Xyx+iTSclZfzTmv0Z0bb56NZ6KEU8WRnks2d7tsb0fq
JTAgLkkCgYBvt5EoxhlCwEUgm8j3nD4TLSRYt1lt6LVulBYA9qlV4F68b2cJUuOi
YTV9H2SWRF6UF+GiR5SajChveS106T9O+tepip+7V5YgFfW+ALOxwar+6V8VoUF4
xNvNTWtaw+wK8xsgxhhYDaWVhVLVhR40QmeQhx/BQm+EYkSSa9kkCQIURGd0R+Zj
tM7dZpB+reWl9L5e2L8=
-----END DSA PRIVATE KEY-----</value>
</data>
<data name="PASSWORD" xml:space="preserve">
<value>tester</value>
</data>
<data name="PORT" xml:space="preserve">
<value>22</value>
</data>
<data name="PROXY_HOST" xml:space="preserve">
<value>proxy.oleg-centos.edc.renci.org</value>
</data>
<data name="PROXY_PORT" xml:space="preserve">
<value>8123</value>
</data>
<data name="RSA_KEY_WITHOUT_PASS" xml:space="preserve">
<value>-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEA8ZsD8jgH7ySXnd4dprEFFkJ+zs1ne81E8febjR8hekiKrc+D
9GjeEykchy0PsrsBrf2F8J3GtLNISVerkl+EnVh1E0pi9Vllc1vcpQHvBeNPG/jl
9Dnum/DcaaMKLot+ARXjBuMX/xJVfnlgkvfpBvoq4QzQ6E27rOMbcPlvrN7KeYba
orsTpDMUraHX5u99P1evvw7sOuNl3lc9YpIgmjHT6dWUGTqBx9T2SEKXBRVk2NNb
d2UctQkr5BJn1gGehA+1KYS30FMiCSN8F8ZOlpYj1+K6xzs0srq1z30LailIyy7Q
mYp739BJlOF3cVywdcFXGre35H2cJylcNV2e+QIBIwKCAQAbnK/+bM207j02nQqz
9vlEX17zECkVdouJXiBn5kz4CEpdAcXwC/wfcmmpDHbSmQeBmVEi0DP3ZPJRhlzA
RW493jlECIBWjd+1aZWPM2vGKJtTp2q802u6DOX9cbgFUcVB899ugFqDjREVxLqU
dBqhtjDJQ0sTPBVy2CBkrsrvLy7AZd4LlaqxpdTdpkD/auUxg4zdThHT/XeQ0V0G
3BS5vGehfqgkDOQpQSm7HexM+9GDJnnzMdNXjmWBPxZU49QAlxujZeZ1M2IgKwMq
eNkWAOnZJidfsfwYluSCi8OHPN2i1s/b7pgn6ffb50S/k2mmhTHxNChDdGTlW91G
6CFLAoGBAPlGA4qzZCG4SLBQicGhhXZlwaKKfTvWNi4xNPZeoJezC0G+yZZT7IIV
zCj83t3dteaRRw15e+7NuIXZx3zl2hANfEpBZwnS4sOekvbS9/S7cEVzOEk53jRU
TOtHRsvNxS2xK3RywqoaqzcPaK2Df917yzbqvEajMRudRPrsTvYdAoGBAPggB/kJ
+VxZf13JqV2KgrFoVvykJpRlw2F5+lkH69ON9gdl976J3TNJDqAmHeWFxBUL+6Lt
9TSpMq3fYueJXg9xaTkSYg177sPRGCmRLO5aneA4nJkIB6KHRXsR71C9D4fJK8Fi
YB5n5dnBUTBhkvaI6KsxcxDzEg2zAJEcn4WNAoGBAOsHf66pI+VHWnpakINdxvqa
dL3TCFz9K8UnFK3G7y/x9Kuz4qOuNsPLaLjua7s+wXL+ASn2MwW6pqoWekKPkxZz
HWqVb8dvEFIKipDyzIepadsU3UxbIfbTI/PG3FnCAw3S7nUbvtrl8eN07arpsxKn
63zr81iLPO4mkX7ezhs/AoGADi23UA8y0hO+Ip3PKeqoYei0g3cYJbysFDLbGwfE
VTtP4ypl7aF6WrO3sWFDiXVbqW5mJpFBNjWN3gzD0rdkdek5NnYUO0jpEoD6EQD7
QNH6ZJWFSpK+m5Kzg2AcTcGpHbO5W4H23SqCKbNGd8sPtlD3Wj1XCEhnbn9B3GgJ
HZMCgYEAjn9BH4fcobMaM15AV0s6sCEyr/vzn3QBfoIBqqqlipMqOtPDv8oyvGO4
5tSpMrTKf4e3YAMPA4TXRAiVLjeRYlhdj3He0LkAuZZabrHeRmWqjDruMWd1TcKZ
3o8DLgYbSH7eGXUJ+euM4spKr5OLkBEkmH7Of6Qxss2njvjVNTE=
-----END RSA PRIVATE KEY-----</value>
</data>
<data name="RSA_KEY_WITH_PASS" xml:space="preserve">
<value>-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,B3475536EDD1B442
Xa6Y7FYTfz19CMzPcVbCpBHEh8x3tnA9PutKEDNMwKbR+NVUvBx5fN1QjrLpltCr
uX7yD3vLCeyihg4oaK3nTBZBcsB/1TZx+MlLgpvMfV1JKmbKCmebBZ3lUpsypHlG
FpCY41miFwdHmBe6tuwL9XA3vz26eJwSgJGMkVN9EBvNbiOHinEPhSW0whzBfbv+
OfseG73gvHc4jZS6Sw8h5VDBAmlldJEfkP/s/1/iTbCXFQ22xRb4Z6NilEyKiWpB
nQviXmaucTWCEuNF5QDA7oV7Ugwm5cAXuBqFIs9ZGaKV4/XpfX1tClOLfB3Lguh+
bbkwjPb0ztlhKa4gkwXiMs0S/lhoueXBae4QStM0qJBXHtFhhRYIn4JeIZ8CJ0k6
SMP7QVfPf5aJIaa8t+SlpvtIFTIkEhTViOCl+udT04670DGwmJUgrJAV0r+/Ytf7
Mi+m3DagN7gGmCvYo+7r7EBl1G6e3hCSYm0rFxGOBesmCWriRoeRpxirWnkrns57
D57pEC1hg90IdycCGpiwqubGDKFljuMLiVd2w0onVhudShPszP+nJAaq18wUB+rE
mtBv+GlpqCITREB4lG2noP4r9P9lgrOTqmKvWjvUTQjfS3u0XO/1aQllKlwe97C7
mfOxcZQWy5F7+9CiWpDpomW7Eso89ja6uyupw4Q4gsm7EUacqOOaVxHrm3MVhYjE
Bfk9I5agKFqeHdjBUUP0DQ6X7JUEtb/Ri8ZrFnyT8sBG7JYnMTXfjPQqdR493cp2
hWI5reZLi4CCUqt4Pcmhm2vtwJz5HXChARPYq2C3DhdJHcdhxUr97rfTGE1w8mPY
JcwSFnNN47UBcDg6nvSfY3SJKV0gmmqz9fEw1pBoCrudJKw9U0vQrNoCEJOpEETG
4XojbAMsTr0Ps5fI2X1VbVYWtU1uyZxqF8KaTCTN1Paapmqaq4N+qIFrrXA+PTH+
dyaMLmYJ263Gy5eNkCZMeWLDFZ9WHX/Zx2ERMXfI6fyGImXkb6E0Dia+bB087BZP
9C5gHAvZIjv+FosZrViFqDfrV5hDXL6bO3+V3zieemRxRCTvMtk+RXUJDd50qIOW
gKNcSbevLPOyQH7eQbR+fU4KtJDUigbTFunSn2MZkDl2GDDlKI35wUAVr5yGsJbE
yiIQe5DgLGZcMiEpqbhuqSfuOw0cUlFVyKeNZ/Hr701HWngLt677IY8ExyuNbBfT
PRaes+hcjJ1QmJoRHZx9rQ3w0IpezCpRkRLRKJzzuQZOuwd95whKFXroFsdeaHxO
hS4PqlLbuSMLiSIaPSZM6Huc4kb5lqCaxg/SBlXTCX17Z/8TFoqV/wCJz17XnkH6
9WtKAC2TwKxiLZ2Qzwr2XV48lASugIOZkSW2qxM9ui+b1T9ICFKRGLn/UB//pOiG
270hNJDLB/BKRExjS+RXeOpdAIJB5XsAEp8h56ub9emhhf9tCEXOn7PN7HbMCnQh
7k8EpAG0h5StLUhY1HHvynVz2/qyMvZa/bIaaudL2565Z6nDU+iBxed7O1qrbRAH
Vakr7Sa3K5niCyH5kxdyO1t29l1ksBqpDUrj+vViFuLkd3XIiui8IA==
-----END RSA PRIVATE KEY-----</value>
</data>
<data name="USERNAME" xml:space="preserve">
<value>tester</value>
</data>
</root>
File diff suppressed because it is too large Load Diff
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Moq" version="4.2.1409.1722" targetFramework="net35" />
</packages>
@@ -0,0 +1,181 @@
using System;
using System.Reflection;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Renci.SshNet.Common;
using Renci.SshNet.Security;
namespace Renci.SshNet.Tests.Classes
{
[TestClass]
public class BaseClientTest_Connect_OnConnectedThrowsException
{
private Mock<IServiceFactory> _serviceFactoryMock;
private Mock<ISession> _sessionMock;
private MyClient _client;
private ConnectionInfo _connectionInfo;
private ApplicationException _onConnectException;
private ApplicationException _actualException;
[TestInitialize]
public void Setup()
{
Arrange();
Act();
}
[TestCleanup]
public void Cleanup()
{
if (_client != null)
{
_sessionMock.Setup(p => p.OnDisconnecting());
_sessionMock.Setup(p => p.Dispose());
_client.Dispose();
}
}
private void SetupData()
{
_connectionInfo = new ConnectionInfo("host", "user", new PasswordAuthenticationMethod("user", "pwd"));
_onConnectException = new ApplicationException();
}
private void CreateMocks()
{
_serviceFactoryMock = new Mock<IServiceFactory>(MockBehavior.Strict);
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
}
private void SetupMocks()
{
_serviceFactoryMock.Setup(p => p.CreateSession(_connectionInfo))
.Returns(_sessionMock.Object);
_sessionMock.Setup(p => p.Connect());
_sessionMock.Setup(p => p.Dispose());
}
protected void Arrange()
{
SetupData();
CreateMocks();
SetupMocks();
_client = new MyClient(_connectionInfo, false, _serviceFactoryMock.Object)
{
OnConnectedException = _onConnectException
};
}
protected void Act()
{
try
{
_client.Connect();
Assert.Fail();
}
catch (ApplicationException ex)
{
_actualException = ex;
}
}
[TestMethod]
public void ConnectShouldRethrowExceptionThrownByOnConnect()
{
Assert.IsNotNull(_actualException);
Assert.AreSame(_onConnectException, _actualException);
}
[TestMethod]
public void CreateSessionOnServiceFactoryShouldBeInvokedOnce()
{
_serviceFactoryMock.Verify(p => p.CreateSession(_connectionInfo), Times.Once);
}
[TestMethod]
public void ConnectOnSessionShouldBeInvokedOnce()
{
_sessionMock.Verify(p => p.Connect(), Times.Once);
}
[TestMethod]
public void DisposeOnSessionShouldBeInvokedOnce()
{
_sessionMock.Verify(p => p.Dispose(), Times.Once);
}
[TestMethod]
public void ErrorOccuredOnSessionShouldNoLongerBeSignaledViaErrorOccurredOnBaseClient()
{
var errorOccurredSignalCount = 0;
_client.ErrorOccurred += (sender, args) => Interlocked.Increment(ref errorOccurredSignalCount);
_sessionMock.Raise(p => p.ErrorOccured += null, new ExceptionEventArgs(new Exception()));
Assert.AreEqual(0, errorOccurredSignalCount);
}
[TestMethod]
public void HostKeyReceivedOnSessionShouldNoLongerBeSignaledViaHostKeyReceivedOnBaseClient()
{
var hostKeyReceivedSignalCount = 0;
_client.HostKeyReceived += (sender, args) => Interlocked.Increment(ref hostKeyReceivedSignalCount);
_sessionMock.Raise(p => p.HostKeyReceived += null, new HostKeyEventArgs(GetKeyHostAlgorithm()));
Assert.AreEqual(0, hostKeyReceivedSignalCount);
}
[TestMethod]
public void SessionShouldBeNull()
{
Assert.IsNull(_client.Session);
}
[TestMethod]
public void IsConnectedShouldReturnFalse()
{
Assert.IsFalse(_client.IsConnected);
}
private static KeyHostAlgorithm GetKeyHostAlgorithm()
{
var executingAssembly = Assembly.GetExecutingAssembly();
using (var s = executingAssembly.GetManifestResourceStream(string.Format("Renci.SshNet.Tests.Data.{0}", "Key.RSA.txt")))
{
var privateKey = new PrivateKeyFile(s);
return (KeyHostAlgorithm) privateKey.HostKey;
}
}
private class MyClient : BaseClient
{
private int _onConnectedCount;
public MyClient(ConnectionInfo connectionInfo, bool ownsConnectionInfo, IServiceFactory serviceFactory) : base(connectionInfo, ownsConnectionInfo, serviceFactory)
{
}
public Exception OnConnectedException { get; set; }
protected override void OnConnected()
{
base.OnConnected();
Interlocked.Increment(ref _onConnectedCount);
if (OnConnectedException != null)
{
throw OnConnectedException;
}
}
}
}
}
@@ -0,0 +1,121 @@
using System;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Renci.SshNet.Messages.Transport;
namespace Renci.SshNet.Tests.Classes
{
[TestClass]
public class BaseClientTest_Connected_KeepAliveInterval_NegativeOne
{
private Mock<IServiceFactory> _serviceFactoryMock;
private Mock<ISession> _sessionMock;
private BaseClient _client;
private ConnectionInfo _connectionInfo;
private TimeSpan _keepAliveInterval;
private int _keepAliveCount;
[TestInitialize]
public void Setup()
{
Arrange();
Act();
}
[TestCleanup]
public void Cleanup()
{
if (_client != null)
{
_sessionMock.Setup(p => p.OnDisconnecting());
_sessionMock.Setup(p => p.Dispose());
_client.Dispose();
}
}
private void SetupData()
{
_connectionInfo = new ConnectionInfo("host", "user", new PasswordAuthenticationMethod("user", "pwd"));
_keepAliveInterval = TimeSpan.FromMilliseconds(100d);
_keepAliveCount = 0;
}
private void CreateMocks()
{
_serviceFactoryMock = new Mock<IServiceFactory>(MockBehavior.Strict);
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
}
private void SetupMocks()
{
_serviceFactoryMock.Setup(p => p.CreateSession(_connectionInfo))
.Returns(_sessionMock.Object);
_sessionMock.Setup(p => p.Connect());
_sessionMock.Setup(p => p.IsConnected).Returns(true);
_sessionMock.Setup(p => p.TrySendMessage(It.IsAny<IgnoreMessage>()))
.Returns(true)
.Callback(() => Interlocked.Increment(ref _keepAliveCount));
}
protected void Arrange()
{
SetupData();
CreateMocks();
SetupMocks();
_client = new MyClient(_connectionInfo, false, _serviceFactoryMock.Object);
_client.Connect();
_client.KeepAliveInterval = _keepAliveInterval;
}
protected void Act()
{
// allow keep-alive to be sent once
Thread.Sleep(150);
// disable keep-alive
_client.KeepAliveInterval = TimeSpan.FromMilliseconds(-1);
}
[TestMethod]
public void KeepAliveIntervalShouldReturnConfiguredValue()
{
Assert.AreEqual(TimeSpan.FromMilliseconds(-1), _client.KeepAliveInterval);
}
[TestMethod]
public void CreateSessionOnServiceFactoryShouldBeInvokedOnce()
{
_serviceFactoryMock.Verify(p => p.CreateSession(_connectionInfo), Times.Once);
}
[TestMethod]
public void ConnectOnSessionShouldBeInvokedOnce()
{
_sessionMock.Verify(p => p.Connect(), Times.Once);
}
[TestMethod]
public void IsConnectedOnSessionShouldBeInvokedOnce()
{
_sessionMock.Verify(p => p.IsConnected, Times.Once);
}
[TestMethod]
public void SendMessageOnSessionShouldBeInvokedThreeTimes()
{
// allow keep-alive to be sent once
Thread.Sleep(100);
_sessionMock.Verify(p => p.TrySendMessage(It.IsAny<IgnoreMessage>()), Times.Exactly(1));
}
private class MyClient : BaseClient
{
public MyClient(ConnectionInfo connectionInfo, bool ownsConnectionInfo, IServiceFactory serviceFactory) : base(connectionInfo, ownsConnectionInfo, serviceFactory)
{
}
}
}
}
@@ -0,0 +1,116 @@
using System;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Renci.SshNet.Messages.Transport;
namespace Renci.SshNet.Tests.Classes
{
[TestClass]
public class BaseClientTest_Connected_KeepAliveInterval_NotNegativeOne
{
private Mock<IServiceFactory> _serviceFactoryMock;
private Mock<ISession> _sessionMock;
private BaseClient _client;
private ConnectionInfo _connectionInfo;
private TimeSpan _keepAliveInterval;
private int _keepAliveCount;
[TestInitialize]
public void Setup()
{
Arrange();
Act();
}
[TestCleanup]
public void Cleanup()
{
if (_client != null)
{
_sessionMock.Setup(p => p.OnDisconnecting());
_sessionMock.Setup(p => p.Dispose());
_client.Dispose();
}
}
private void SetupData()
{
_connectionInfo = new ConnectionInfo("host", "user", new PasswordAuthenticationMethod("user", "pwd"));
_keepAliveInterval = TimeSpan.FromMilliseconds(50d);
_keepAliveCount = 0;
}
private void CreateMocks()
{
_serviceFactoryMock = new Mock<IServiceFactory>(MockBehavior.Strict);
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
}
private void SetupMocks()
{
_serviceFactoryMock.Setup(p => p.CreateSession(_connectionInfo))
.Returns(_sessionMock.Object);
_sessionMock.Setup(p => p.Connect());
_sessionMock.Setup(p => p.IsConnected).Returns(true);
_sessionMock.Setup(p => p.TrySendMessage(It.IsAny<IgnoreMessage>()))
.Returns(true)
.Callback(() => Interlocked.Increment(ref _keepAliveCount));
}
protected void Arrange()
{
SetupData();
CreateMocks();
SetupMocks();
_client = new MyClient(_connectionInfo, false, _serviceFactoryMock.Object);
_client.Connect();
}
protected void Act()
{
_client.KeepAliveInterval = _keepAliveInterval;
// allow keep-alive to be sent a few times
Thread.Sleep(195);
}
[TestMethod]
public void KeepAliveIntervalShouldReturnConfiguredValue()
{
Assert.AreEqual(_keepAliveInterval, _client.KeepAliveInterval);
}
[TestMethod]
public void CreateSessionOnServiceFactoryShouldBeInvokedOnce()
{
_serviceFactoryMock.Verify(p => p.CreateSession(_connectionInfo), Times.Once);
}
[TestMethod]
public void ConnectOnSessionShouldBeInvokedOnce()
{
_sessionMock.Verify(p => p.Connect(), Times.Once);
}
[TestMethod]
public void IsConnectedOnSessionShouldBeInvokedOnce()
{
_sessionMock.Verify(p => p.IsConnected, Times.Once);
}
[TestMethod]
public void SendMessageOnSessionShouldBeInvokedThreeTimes()
{
_sessionMock.Verify(p => p.TrySendMessage(It.IsAny<IgnoreMessage>()), Times.Exactly(3));
}
private class MyClient : BaseClient
{
public MyClient(ConnectionInfo connectionInfo, bool ownsConnectionInfo, IServiceFactory serviceFactory) : base(connectionInfo, ownsConnectionInfo, serviceFactory)
{
}
}
}
}
@@ -34,25 +34,38 @@ namespace Renci.SshNet.Tests.Classes
}
}
protected void Arrange()
private void SetupData()
{
_connectionInfo = new ConnectionInfo("host", "user", new PasswordAuthenticationMethod("user", "pwd"));
_keepAliveSent = new ManualResetEvent(false);
}
private void CreateMocks()
{
_serviceFactoryMock = new Mock<IServiceFactory>(MockBehavior.Strict);
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
}
private void SetupMocks()
{
_mockSequence = new MockSequence();
_serviceFactoryMock.InSequence(_mockSequence).Setup(p => p.CreateSession(_connectionInfo)).Returns(_sessionMock.Object);
_sessionMock.InSequence(_mockSequence).Setup(p => p.Connect());
_sessionMock.InSequence(_mockSequence).Setup(p => p.TrySendMessage(It.IsAny<IgnoreMessage>()))
.Returns(true)
.Callback(() =>
{
Thread.Sleep(300);
_keepAliveSent.Set();
});
.Returns(true)
.Callback(() =>
{
Thread.Sleep(300);
_keepAliveSent.Set();
});
}
protected void Arrange()
{
SetupData();
CreateMocks();
SetupMocks();
_client = new MyClient(_connectionInfo, false, _serviceFactoryMock.Object)
{
@@ -0,0 +1,113 @@
using System;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Renci.SshNet.Messages.Transport;
namespace Renci.SshNet.Tests.Classes
{
[TestClass]
public class BaseClientTest_Disconnected_KeepAliveInterval_NotNegativeOne
{
private Mock<IServiceFactory> _serviceFactoryMock;
private Mock<ISession> _sessionMock;
private BaseClient _client;
private ConnectionInfo _connectionInfo;
private TimeSpan _keepAliveInterval;
[TestInitialize]
public void Setup()
{
Arrange();
Act();
}
[TestCleanup]
public void Cleanup()
{
if (_client != null)
{
_sessionMock.Setup(p => p.OnDisconnecting());
_sessionMock.Setup(p => p.Dispose());
_client.Dispose();
}
}
private void SetupData()
{
_connectionInfo = new ConnectionInfo("host", "user", new PasswordAuthenticationMethod("user", "pwd"));
_keepAliveInterval = TimeSpan.FromMilliseconds(50d);
}
private void CreateMocks()
{
_serviceFactoryMock = new Mock<IServiceFactory>(MockBehavior.Strict);
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
}
private void SetupMocks()
{
_serviceFactoryMock.Setup(p => p.CreateSession(_connectionInfo))
.Returns(_sessionMock.Object);
_sessionMock.Setup(p => p.Connect());
_sessionMock.Setup(p => p.IsConnected).Returns(false);
_sessionMock.Setup(p => p.TrySendMessage(It.IsAny<IgnoreMessage>()))
.Returns(true);
}
protected void Arrange()
{
SetupData();
CreateMocks();
SetupMocks();
_client = new MyClient(_connectionInfo, false, _serviceFactoryMock.Object);
_client.Connect();
}
protected void Act()
{
_client.KeepAliveInterval = _keepAliveInterval;
// allow keep-alive to be sent a few times
Thread.Sleep(195);
}
[TestMethod]
public void KeepAliveIntervalShouldReturnConfiguredValue()
{
Assert.AreEqual(_keepAliveInterval, _client.KeepAliveInterval);
}
[TestMethod]
public void CreateSessionOnServiceFactoryShouldBeInvokedOnce()
{
_serviceFactoryMock.Verify(p => p.CreateSession(_connectionInfo), Times.Once);
}
[TestMethod]
public void ConnectOnSessionShouldBeInvokedOnce()
{
_sessionMock.Verify(p => p.Connect(), Times.Once);
}
[TestMethod]
public void IsConnectedOnSessionShouldBeInvokedOnce()
{
_sessionMock.Verify(p => p.IsConnected, Times.Once);
}
[TestMethod]
public void SendMessageOnSessionShouldNeverBeInvoked()
{
_sessionMock.Verify(p => p.TrySendMessage(It.IsAny<IgnoreMessage>()), Times.Never);
}
private class MyClient : BaseClient
{
public MyClient(ConnectionInfo connectionInfo, bool ownsConnectionInfo, IServiceFactory serviceFactory) : base(connectionInfo, ownsConnectionInfo, serviceFactory)
{
}
}
}
}
@@ -0,0 +1,102 @@
using System;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Renci.SshNet.Messages.Transport;
namespace Renci.SshNet.Tests.Classes
{
[TestClass]
public class BaseClientTest_NotConnected_KeepAliveInterval_NotNegativeOne
{
private Mock<IServiceFactory> _serviceFactoryMock;
private Mock<ISession> _sessionMock;
private BaseClient _client;
private ConnectionInfo _connectionInfo;
private TimeSpan _keepAliveInterval;
private int _keepAliveCount;
[TestInitialize]
public void Setup()
{
Arrange();
Act();
}
[TestCleanup]
public void Cleanup()
{
if (_client != null)
{
_sessionMock.Setup(p => p.OnDisconnecting());
_sessionMock.Setup(p => p.Dispose());
_client.Dispose();
}
}
private void SetupData()
{
_connectionInfo = new ConnectionInfo("host", "user", new PasswordAuthenticationMethod("user", "pwd"));
_keepAliveInterval = TimeSpan.FromMilliseconds(100d);
_keepAliveCount = 0;
}
private void CreateMocks()
{
_serviceFactoryMock = new Mock<IServiceFactory>(MockBehavior.Strict);
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
}
private static void SetupMocks()
{
}
protected void Arrange()
{
SetupData();
CreateMocks();
SetupMocks();
_client = new MyClient(_connectionInfo, false, _serviceFactoryMock.Object);
}
protected void Act()
{
_client.KeepAliveInterval = _keepAliveInterval;
// allow keep-alive to be sent at least once
Thread.Sleep(150);
}
[TestMethod]
public void KeepAliveIntervalShouldReturnConfiguredValue()
{
Assert.AreEqual(_keepAliveInterval, _client.KeepAliveInterval);
}
[TestMethod]
public void ConnectShouldActivateKeepAliveIfSessionIs()
{
_serviceFactoryMock.Setup(p => p.CreateSession(_connectionInfo)).Returns(_sessionMock.Object);
_sessionMock.Setup(p => p.Connect());
_sessionMock.Setup(p => p.TrySendMessage(It.IsAny<IgnoreMessage>()))
.Returns(true)
.Callback(() => Interlocked.Increment(ref _keepAliveCount));
_client.Connect();
// allow keep-alive to be sent twice
Thread.Sleep(250);
// Exactly two keep-alives should be sent
_sessionMock.Verify(p => p.TrySendMessage(It.IsAny<IgnoreMessage>()), Times.Exactly(2));
}
private class MyClient : BaseClient
{
public MyClient(ConnectionInfo connectionInfo, bool ownsConnectionInfo, IServiceFactory serviceFactory) : base(connectionInfo, ownsConnectionInfo, serviceFactory)
{
}
}
}
}
@@ -27,6 +27,7 @@ namespace Renci.SshNet.Tests.Classes.Channels
private uint _remoteWindowSize;
private uint _remotePacketSize;
private uint _remoteChannelNumber;
private TimeSpan _channelCloseTimeout;
protected override void OnInit()
{
@@ -40,8 +41,9 @@ namespace Renci.SshNet.Tests.Classes.Channels
_port = (uint) random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort);
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_remoteWindowSize = (uint) random.Next(0, int.MaxValue);
_remotePacketSize = (uint)random.Next(100, 200);
_remoteChannelNumber = (uint)random.Next(0, int.MaxValue);
_remotePacketSize = (uint) random.Next(100, 200);
_remoteChannelNumber = (uint) random.Next(0, int.MaxValue);
_channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20));
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
_forwardedPortMock = new Mock<IForwardedPort>(MockBehavior.Strict);
@@ -53,11 +55,14 @@ namespace Renci.SshNet.Tests.Classes.Channels
{
_sessionMock.Setup(p => p.IsConnected).Returns(true);
_sessionMock.Setup(p => p.SendMessage(It.IsAny<ChannelOpenMessage>()))
.Callback<Message>(m => _sessionMock.Raise(p => p.ChannelOpenConfirmationReceived += null,
new MessageEventArgs<ChannelOpenConfirmationMessage>(
new ChannelOpenConfirmationMessage(((ChannelOpenMessage)m).LocalChannelNumber, _remoteWindowSize, _remotePacketSize, _remoteChannelNumber))));
.Callback<Message>(m => _sessionMock.Raise(p => p.ChannelOpenConfirmationReceived += null,
new MessageEventArgs<ChannelOpenConfirmationMessage>(
new ChannelOpenConfirmationMessage(((ChannelOpenMessage) m).LocalChannelNumber,
_remoteWindowSize,
_remotePacketSize,
_remoteChannelNumber))));
_sessionMock.Setup(p => p.WaitOnHandle(It.IsAny<EventWaitHandle>()))
.Callback<WaitHandle>(p => p.WaitOne(Session.Infinite));
.Callback<WaitHandle>(p => p.WaitOne(Session.Infinite));
var localPortEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
using (var localPortListener = new AsyncSocketListener(localPortEndPoint))
@@ -65,25 +70,27 @@ namespace Renci.SshNet.Tests.Classes.Channels
localPortListener.Start();
localPortListener.Connected += socket =>
{
var channel = new ChannelDirectTcpip(_sessionMock.Object, _localChannelNumber, _localWindowSize,
_localPacketSize);
channel.Open(_remoteHost, _port, _forwardedPortMock.Object, socket);
{
var channel = new ChannelDirectTcpip(_sessionMock.Object,
_localChannelNumber,
_localWindowSize,
_localPacketSize);
channel.Open(_remoteHost, _port, _forwardedPortMock.Object, socket);
var closeForwardedPortThread =
new Thread(() =>
{
// sleep for a short period to allow channel to actually start receiving from socket
Thread.Sleep(100);
// raise Closing event on forwarded port
_forwardedPortMock.Raise(p => p.Closing += null, EventArgs.Empty);
});
closeForwardedPortThread.Start();
var closeForwardedPortThread =
new Thread(() =>
{
// sleep for a short period to allow channel to actually start receiving from socket
Thread.Sleep(100);
// raise Closing event on forwarded port
_forwardedPortMock.Raise(p => p.Closing += null, EventArgs.Empty);
});
closeForwardedPortThread.Start();
channel.Bind();
channel.Bind();
closeForwardedPortThread.Join();
};
closeForwardedPortThread.Join();
};
var client = new Socket(localPortEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
client.Connect(localPortEndPoint);
@@ -103,11 +110,14 @@ namespace Renci.SshNet.Tests.Classes.Channels
{
_sessionMock.Setup(p => p.IsConnected).Returns(true);
_sessionMock.Setup(p => p.SendMessage(It.IsAny<ChannelOpenMessage>()))
.Callback<Message>(m => _sessionMock.Raise(p => p.ChannelOpenConfirmationReceived += null,
new MessageEventArgs<ChannelOpenConfirmationMessage>(
new ChannelOpenConfirmationMessage(((ChannelOpenMessage)m).LocalChannelNumber, _remoteWindowSize, _remotePacketSize, _remoteChannelNumber))));
.Callback<Message>(m => _sessionMock.Raise(p => p.ChannelOpenConfirmationReceived += null,
new MessageEventArgs<ChannelOpenConfirmationMessage>(
new ChannelOpenConfirmationMessage(((ChannelOpenMessage) m).LocalChannelNumber,
_remoteWindowSize,
_remotePacketSize,
_remoteChannelNumber))));
_sessionMock.Setup(p => p.WaitOnHandle(It.IsAny<EventWaitHandle>()))
.Callback<WaitHandle>(p => p.WaitOne(Session.Infinite));
.Callback<WaitHandle>(p => p.WaitOne(Session.Infinite));
var localPortEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
using (var localPortListener = new AsyncSocketListener(localPortEndPoint))
@@ -116,19 +126,21 @@ namespace Renci.SshNet.Tests.Classes.Channels
localPortListener.Connected += socket =>
{
var channel = new ChannelDirectTcpip(_sessionMock.Object, _localChannelNumber, _localWindowSize,
_localPacketSize);
var channel = new ChannelDirectTcpip(_sessionMock.Object,
_localChannelNumber,
_localWindowSize,
_localPacketSize);
channel.Open(_remoteHost, _port, _forwardedPortMock.Object, socket);
var signalSessionErrorOccurredThread =
new Thread(() =>
{
// sleep for a short period to allow channel to actually start receiving from socket
Thread.Sleep(100);
// raise ErrorOccured event on session
_sessionMock.Raise(s => s.ErrorOccured += null,
new ExceptionEventArgs(new SystemException()));
});
{
// sleep for a short period to allow channel to actually start receiving from socket
Thread.Sleep(100);
// raise ErrorOccured event on session
_sessionMock.Raise(s => s.ErrorOccured += null,
new ExceptionEventArgs(new SystemException()));
});
signalSessionErrorOccurredThread.Start();
channel.Bind();
@@ -152,34 +164,49 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void SocketShouldBeClosedAndEofShouldBeSentToServerWhenClientShutsDownSocket()
{
_sessionMock.Setup(p => p.IsConnected).Returns(true);
_sessionMock.Setup(p => p.SendMessage(It.IsAny<ChannelOpenMessage>()))
.Callback<Message>(m => _sessionMock.Raise(p => p.ChannelOpenConfirmationReceived += null,
new MessageEventArgs<ChannelOpenConfirmationMessage>(
new ChannelOpenConfirmationMessage(((ChannelOpenMessage) m).LocalChannelNumber,
_remoteWindowSize, _remotePacketSize, _remoteChannelNumber))));
_sessionMock.Setup(p => p.WaitOnHandle(It.IsAny<EventWaitHandle>()))
.Callback<WaitHandle>(p => p.WaitOne(Session.Infinite));
_sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object);
_connectionInfoMock.Setup(p => p.Timeout).Returns(TimeSpan.FromSeconds(60));
_sessionMock.Setup(p => p.TrySendMessage(It.IsAny<ChannelEofMessage>()))
.Returns(true)
.Callback<Message>(
m => new Thread(() =>
{
Thread.Sleep(50);
_sessionMock.Raise(s => s.ChannelEofReceived += null,
new MessageEventArgs<ChannelEofMessage>(new ChannelEofMessage(_localChannelNumber)));
}).Start());
_sessionMock.Setup(p => p.TrySendMessage(It.IsAny<ChannelCloseMessage>()))
.Returns(true)
.Callback<Message>(
m => new Thread(() =>
{
Thread.Sleep(50);
_sessionMock.Raise(s => s.ChannelCloseReceived += null,
new MessageEventArgs<ChannelCloseMessage>(new ChannelCloseMessage(_localChannelNumber)));
}).Start());
var sequence = new MockSequence();
_sessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
_sessionMock.InSequence(sequence)
.Setup(p => p.SendMessage(It.IsAny<ChannelOpenMessage>()))
.Callback<Message>(m => _sessionMock.Raise(p => p.ChannelOpenConfirmationReceived += null,
new MessageEventArgs<ChannelOpenConfirmationMessage>(
new ChannelOpenConfirmationMessage(((ChannelOpenMessage) m).LocalChannelNumber,
_remoteWindowSize,
_remotePacketSize,
_remoteChannelNumber))));
_sessionMock.InSequence(sequence)
.Setup(p => p.WaitOnHandle(It.IsAny<EventWaitHandle>()))
.Callback<WaitHandle>(p => p.WaitOne(Session.Infinite));
_sessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
_sessionMock.InSequence(sequence)
.Setup(p => p.TrySendMessage(It.IsAny<ChannelEofMessage>()))
.Returns(true)
.Callback<Message>(
m => new Thread(() =>
{
Thread.Sleep(50);
_sessionMock.Raise(s => s.ChannelEofReceived += null,
new MessageEventArgs<ChannelEofMessage>(new ChannelEofMessage(_localChannelNumber)));
}).Start());
_sessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
_sessionMock.InSequence(sequence)
.Setup(p => p.TrySendMessage(It.IsAny<ChannelCloseMessage>()))
.Returns(true)
.Callback<Message>(
m => new Thread(() =>
{
Thread.Sleep(50);
_sessionMock.Raise(s => s.ChannelCloseReceived += null,
new MessageEventArgs<ChannelCloseMessage>(new ChannelCloseMessage(_localChannelNumber)));
}).Start());
_sessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object);
_connectionInfoMock.InSequence(sequence).Setup(p => p.ChannelCloseTimeout).Returns(_channelCloseTimeout);
_sessionMock.InSequence(sequence)
.Setup(p => p.TryWait(It.IsAny<EventWaitHandle>(), _channelCloseTimeout))
.Callback<WaitHandle, TimeSpan>((waitHandle, channelCloseTimeout) => waitHandle.WaitOne())
.Returns(WaitResult.Success);
var channelBindFinishedWaitHandle = new ManualResetEvent(false);
Socket handler = null;
ChannelDirectTcpip channel = null;
@@ -190,17 +217,19 @@ namespace Renci.SshNet.Tests.Classes.Channels
localPortListener.Start();
localPortListener.Connected += socket =>
{
channel = new ChannelDirectTcpip(_sessionMock.Object, _localChannelNumber, _localWindowSize,
_localPacketSize);
channel.Open(_remoteHost, _port, _forwardedPortMock.Object, socket);
channel.Bind();
channel.Dispose();
{
channel = new ChannelDirectTcpip(_sessionMock.Object,
_localChannelNumber,
_localWindowSize,
_localPacketSize);
channel.Open(_remoteHost, _port, _forwardedPortMock.Object, socket);
channel.Bind();
channel.Dispose();
handler = socket;
handler = socket;
channelBindFinishedWaitHandle.Set();
};
channelBindFinishedWaitHandle.Set();
};
var client = new Socket(localPortEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
client.Connect(localPortEndPoint);
@@ -18,6 +18,7 @@ namespace Renci.SshNet.Tests.Classes.Channels
public class ChannelDirectTcpipTest_Dispose_SessionIsConnectedAndChannelIsOpen
{
private Mock<ISession> _sessionMock;
private Mock<IConnectionInfo> _connectionInfoMock;
private Mock<IForwardedPort> _forwardedPortMock;
private ChannelDirectTcpip _channel;
private uint _localChannelNumber;
@@ -26,6 +27,7 @@ namespace Renci.SshNet.Tests.Classes.Channels
private uint _remoteWindowSize;
private uint _remotePacketSize;
private uint _remoteChannelNumber;
private TimeSpan _channelCloseTimeout;
private string _remoteHost;
private uint _port;
private AsyncSocketListener _listener;
@@ -60,9 +62,11 @@ namespace Renci.SshNet.Tests.Classes.Channels
private void Arrange()
{
var random = new Random();
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(2000, 3000);
_localPacketSize = (uint) random.Next(1000, 2000);
_channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20));
_remoteHost = random.Next().ToString(CultureInfo.InvariantCulture);
_port = (uint) random.Next(IPEndPoint.MinPort, IPEndPoint.MaxPort);
_channelBindFinishedWaitHandle = new ManualResetEvent(false);
@@ -74,6 +78,7 @@ namespace Renci.SshNet.Tests.Classes.Channels
_remotePacketSize = (uint)random.Next(100, 200);
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
_connectionInfoMock = new Mock<IConnectionInfo>(MockBehavior.Strict);
_forwardedPortMock = new Mock<IForwardedPort>(MockBehavior.Strict);
var sequence = new MockSequence();
@@ -102,19 +107,20 @@ namespace Renci.SshNet.Tests.Classes.Channels
.Returns(true);
_sessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
_sessionMock.InSequence(sequence)
.Setup(
p => p.TrySendMessage(It.Is<ChannelCloseMessage>(m => m.LocalChannelNumber == _remoteChannelNumber)))
.Setup(p => p.TrySendMessage(It.Is<ChannelCloseMessage>(m => m.LocalChannelNumber == _remoteChannelNumber)))
.Returns(true);
_sessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object);
_connectionInfoMock.InSequence(sequence).Setup(p => p.ChannelCloseTimeout).Returns(_channelCloseTimeout);
_sessionMock.InSequence(sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
_sessionMock.Raise(
s => s.ChannelCloseReceived += null,
new MessageEventArgs<ChannelCloseMessage>(new ChannelCloseMessage(_localChannelNumber)));
w.WaitOne();
});
.Setup(p => p.TryWait(It.IsAny<EventWaitHandle>(), _channelCloseTimeout))
.Callback<WaitHandle, TimeSpan>((waitHandle, channelCloseTimeout) =>
{
_sessionMock.Raise(
s => s.ChannelCloseReceived += null,
new MessageEventArgs<ChannelCloseMessage>(new ChannelCloseMessage(_localChannelNumber)));
waitHandle.WaitOne();
})
.Returns(WaitResult.Success);
var localEndpoint = new IPEndPoint(IPAddress.Loopback, 8122);
_listener = new AsyncSocketListener(localEndpoint);
@@ -122,11 +128,10 @@ namespace Renci.SshNet.Tests.Classes.Channels
{
try
{
_channel = new ChannelDirectTcpip(
_sessionMock.Object,
_localChannelNumber,
_localWindowSize,
_localPacketSize);
_channel = new ChannelDirectTcpip(_sessionMock.Object,
_localChannelNumber,
_localWindowSize,
_localPacketSize);
_channel.Open(_remoteHost, _port, _forwardedPortMock.Object, socket);
_channel.Bind();
}
@@ -25,6 +25,7 @@ namespace Renci.SshNet.Tests.Classes.Channels
private uint _remoteWindowSize;
private uint _remotePacketSize;
private uint _remoteChannelNumber;
private TimeSpan _channelCloseTimeout;
private IPEndPoint _remoteEndpoint;
private AsyncSocketListener _remoteListener;
private EventWaitHandle _channelBindFinishedWaitHandle;
@@ -72,6 +73,7 @@ namespace Renci.SshNet.Tests.Classes.Channels
_remoteChannelNumber = (uint) random.Next(0, int.MaxValue);
_remoteWindowSize = (uint) random.Next(0, int.MaxValue);
_remotePacketSize = (uint) random.Next(100, 200);
_channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20));
_channelBindFinishedWaitHandle = new ManualResetEvent(false);
_channelException = null;
_connectedRegister = new List<Socket>();
@@ -109,16 +111,18 @@ namespace Renci.SshNet.Tests.Classes.Channels
.Setup(
p => p.TrySendMessage(It.Is<ChannelCloseMessage>(m => m.LocalChannelNumber == _remoteChannelNumber)))
.Returns(true);
_sessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object);
_connectionInfoMock.InSequence(sequence).Setup(p => p.ChannelCloseTimeout).Returns(_channelCloseTimeout);
_sessionMock.InSequence(sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
.Setup(p => p.TryWait(It.IsAny<EventWaitHandle>(), _channelCloseTimeout))
.Callback<WaitHandle, TimeSpan>((waitHandle, channelCloseTimeout) =>
{
_sessionMock.Raise(
s => s.ChannelCloseReceived += null,
new MessageEventArgs<ChannelCloseMessage>(new ChannelCloseMessage(_localChannelNumber)));
w.WaitOne();
});
waitHandle.WaitOne();
})
.Returns(WaitResult.Success);
_remoteListener = new AsyncSocketListener(_remoteEndpoint);
_remoteListener.Connected += socket => _connectedRegister.Add(socket);
@@ -0,0 +1,37 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
namespace Renci.SshNet.Tests.Classes.Channels
{
public abstract class ChannelSessionTestBase
{
internal Mock<ISession> SessionMock { get; private set; }
internal Mock<IConnectionInfo> ConnectionInfoMock { get; private set; }
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
protected abstract void SetupData();
protected void CreateMocks()
{
SessionMock = new Mock<ISession>(MockBehavior.Strict);
ConnectionInfoMock = new Mock<IConnectionInfo>(MockBehavior.Strict);
}
protected abstract void SetupMocks();
protected virtual void Arrange()
{
SetupData();
CreateMocks();
SetupMocks();
}
protected abstract void Act();
}
}
@@ -10,10 +10,8 @@ using Renci.SshNet.Messages.Connection;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelSessionTest_Dispose_Disposed
public class ChannelSessionTest_Dispose_Disposed : ChannelSessionTestBase
{
private Mock<ISession> _sessionMock;
private Mock<IConnectionInfo> _connectionInfoMock;
private ChannelSession _channel;
private uint _localChannelNumber;
private uint _localWindowSize;
@@ -21,38 +19,35 @@ namespace Renci.SshNet.Tests.Classes.Channels
private uint _remoteWindowSize;
private uint _remotePacketSize;
private uint _remoteChannelNumber;
private TimeSpan _channelCloseTimeout;
private SemaphoreLight _sessionSemaphore;
private IList<ChannelEventArgs> _channelClosedRegister;
private List<ExceptionEventArgs> _channelExceptionRegister;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint)random.Next(0, int.MaxValue);
_localWindowSize = (uint)random.Next(2000, 3000);
_localPacketSize = (uint)random.Next(1000, 2000);
_remoteChannelNumber = (uint)random.Next(0, int.MaxValue);
_remoteWindowSize = (uint)random.Next(0, int.MaxValue);
_remotePacketSize = (uint)random.Next(100, 200);
_channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20));
_sessionSemaphore = new SemaphoreLight(1);
_channelClosedRegister = new List<ChannelEventArgs>();
_channelExceptionRegister = new List<ExceptionEventArgs>();
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
_connectionInfoMock = new Mock<IConnectionInfo>(MockBehavior.Strict);
protected override void SetupMocks()
{
var sequence = new MockSequence();
_sessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object);
_connectionInfoMock.InSequence(sequence).Setup(p => p.RetryAttempts).Returns(1);
_sessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
_sessionMock.InSequence(sequence)
SessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(sequence).Setup(p => p.RetryAttempts).Returns(1);
SessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
SessionMock.InSequence(sequence)
.Setup(
p =>
p.SendMessage(
@@ -61,12 +56,12 @@ namespace Renci.SshNet.Tests.Classes.Channels
m.LocalChannelNumber == _localChannelNumber &&
m.InitialWindowSize == _localWindowSize && m.MaximumPacketSize == _localPacketSize &&
m.Info is SessionChannelOpenInfo)));
_sessionMock.InSequence(sequence)
SessionMock.InSequence(sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
_sessionMock.Raise(
SessionMock.Raise(
s => s.ChannelOpenConfirmationReceived += null,
new MessageEventArgs<ChannelOpenConfirmationMessage>(
new ChannelOpenConfirmationMessage(
@@ -76,31 +71,39 @@ namespace Renci.SshNet.Tests.Classes.Channels
_remoteChannelNumber)));
w.WaitOne();
});
_sessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
_sessionMock.InSequence(sequence)
SessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
SessionMock.InSequence(sequence)
.Setup(p => p.TrySendMessage(It.Is<ChannelEofMessage>(m => m.LocalChannelNumber == _remoteChannelNumber))).Returns(true);
_sessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
_sessionMock.InSequence(sequence)
SessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
SessionMock.InSequence(sequence)
.Setup(p => p.TrySendMessage(It.Is<ChannelCloseMessage>(m => m.LocalChannelNumber == _remoteChannelNumber))).Returns(true);
_sessionMock.InSequence(sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
_sessionMock.Raise(
s => s.ChannelCloseReceived += null,
new MessageEventArgs<ChannelCloseMessage>(new ChannelCloseMessage(_localChannelNumber)));
w.WaitOne();
});
SessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(sequence).Setup(p => p.ChannelCloseTimeout).Returns(_channelCloseTimeout);
SessionMock.InSequence(sequence)
.Setup(p => p.TryWait(It.IsNotNull<WaitHandle>(), _channelCloseTimeout))
.Callback<WaitHandle, TimeSpan>(
(waitHandle, channelCloseTimeout) =>
{
SessionMock.Raise(
s => s.ChannelCloseReceived += null,
new MessageEventArgs<ChannelCloseMessage>(new ChannelCloseMessage(_localChannelNumber)));
waitHandle.WaitOne();
})
.Returns(WaitResult.Success);
}
_channel = new ChannelSession(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelSession(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) => _channelClosedRegister.Add(args);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.Open();
_channel.Dispose();
}
protected virtual void Act()
protected override void Act()
{
_channel.Dispose();
}
@@ -113,13 +116,13 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ChannelEofMessageShouldBeSentOnce()
{
_sessionMock.Verify(p => p.TrySendMessage(It.Is<ChannelEofMessage>(m => m.LocalChannelNumber == _remoteChannelNumber)), Times.Once);
SessionMock.Verify(p => p.TrySendMessage(It.Is<ChannelEofMessage>(m => m.LocalChannelNumber == _remoteChannelNumber)), Times.Once);
}
[TestMethod]
public void ChannelCloseMessageShouldBeSentOnce()
{
_sessionMock.Verify(p => p.TrySendMessage(It.Is<ChannelCloseMessage>(m => m.LocalChannelNumber == _remoteChannelNumber)), Times.Once);
SessionMock.Verify(p => p.TrySendMessage(It.Is<ChannelCloseMessage>(m => m.LocalChannelNumber == _remoteChannelNumber)), Times.Once);
}
[TestMethod]
@@ -11,52 +11,47 @@ using Renci.SshNet.Tests.Common;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelCloseAndChannelEofReceived_DisposeInEventHandler
public class ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelCloseAndChannelEofReceived_DisposeInEventHandler : ChannelSessionTestBase
{
private Mock<ISession> _sessionMock;
private uint _localChannelNumber;
private uint _localWindowSize;
private uint _localPacketSize;
private uint _remoteChannelNumber;
private uint _remoteWindowSize;
private uint _remotePacketSize;
private TimeSpan _channelCloseTimeout;
private IList<ChannelEventArgs> _channelClosedRegister;
private List<ExceptionEventArgs> _channelExceptionRegister;
private ChannelSession _channel;
private Mock<IConnectionInfo> _connectionInfoMock;
private MockSequence _sequence;
private SemaphoreLight _sessionSemaphore;
private int _initialSessionSemaphoreCount;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint)random.Next(0, int.MaxValue);
_localWindowSize = (uint)random.Next(0, int.MaxValue);
_localPacketSize = (uint)random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint)random.Next(0, int.MaxValue);
_remoteWindowSize = (uint)random.Next(0, int.MaxValue);
_remotePacketSize = (uint)random.Next(0, int.MaxValue);
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(0, int.MaxValue);
_localPacketSize = (uint) random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint) random.Next(0, int.MaxValue);
_remoteWindowSize = (uint) random.Next(0, int.MaxValue);
_remotePacketSize = (uint) random.Next(0, int.MaxValue);
_channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20));
_channelClosedRegister = new List<ChannelEventArgs>();
_channelExceptionRegister = new List<ExceptionEventArgs>();
_initialSessionSemaphoreCount = random.Next(10, 20);
_sessionSemaphore = new SemaphoreLight(_initialSessionSemaphoreCount);
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
_connectionInfoMock = new Mock<IConnectionInfo>(MockBehavior.Strict);
protected override void SetupMocks()
{
_sequence = new MockSequence();
_sessionMock.InSequence(_sequence).Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object);
_connectionInfoMock.InSequence(_sequence).Setup(p => p.RetryAttempts).Returns(1);
_sessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
_sessionMock.InSequence(_sequence)
SessionMock.InSequence(_sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(_sequence).Setup(p => p.RetryAttempts).Returns(1);
SessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
SessionMock.InSequence(_sequence)
.Setup(
p =>
p.SendMessage(
@@ -65,12 +60,12 @@ namespace Renci.SshNet.Tests.Classes.Channels
m.LocalChannelNumber == _localChannelNumber &&
m.InitialWindowSize == _localWindowSize && m.MaximumPacketSize == _localPacketSize &&
m.Info is SessionChannelOpenInfo)));
_sessionMock.InSequence(_sequence)
SessionMock.InSequence(_sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
_sessionMock.Raise(
SessionMock.Raise(
s => s.ChannelOpenConfirmationReceived += null,
new MessageEventArgs<ChannelOpenConfirmationMessage>(
new ChannelOpenConfirmationMessage(
@@ -80,15 +75,23 @@ namespace Renci.SshNet.Tests.Classes.Channels
_remoteChannelNumber)));
w.WaitOne();
});
_sessionMock.InSequence(_sequence).Setup(p => p.IsConnected).Returns(true);
_sessionMock.InSequence(_sequence)
SessionMock.InSequence(_sequence).Setup(p => p.IsConnected).Returns(true);
SessionMock.InSequence(_sequence)
.Setup(p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber)))
.Returns(true);
_sessionMock.InSequence(_sequence)
.Setup(s => s.WaitOnHandle(It.IsNotNull<EventWaitHandle>()))
.Callback<WaitHandle>(w => w.WaitOne());
SessionMock.InSequence(_sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(_sequence).Setup(p => p.ChannelCloseTimeout).Returns(_channelCloseTimeout);
SessionMock.InSequence(_sequence)
.Setup(p => p.TryWait(It.IsNotNull<WaitHandle>(), _channelCloseTimeout))
.Callback<WaitHandle, TimeSpan>((waitHandle, channelCloseTimeout) => waitHandle.WaitOne())
.Returns(WaitResult.Success);
}
_channel = new ChannelSession(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelSession(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) =>
{
_channelClosedRegister.Add(args);
@@ -97,13 +100,13 @@ namespace Renci.SshNet.Tests.Classes.Channels
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.Open();
_sessionMock.Raise(p => p.ChannelEofReceived += null,
SessionMock.Raise(p => p.ChannelEofReceived += null,
new MessageEventArgs<ChannelEofMessage>(new ChannelEofMessage(_localChannelNumber)));
_sessionMock.Raise(p => p.ChannelCloseReceived += null,
SessionMock.Raise(p => p.ChannelCloseReceived += null,
new MessageEventArgs<ChannelCloseMessage>(new ChannelCloseMessage(_localChannelNumber)));
}
private void Act()
protected override void Act()
{
_channel.Dispose();
}
@@ -133,4 +136,4 @@ namespace Renci.SshNet.Tests.Classes.Channels
Assert.IsFalse(_channel.IsOpen);
}
}
}
}
@@ -10,9 +10,8 @@ using Renci.SshNet.Messages.Connection;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelCloseAndChannelEofReceived_SendChannelCloseMessageFailure
public class ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelCloseAndChannelEofReceived_SendChannelCloseMessageFailure : ChannelSessionTestBase
{
private Mock<ISession> _sessionMock;
private uint _localChannelNumber;
private uint _localWindowSize;
private uint _localPacketSize;
@@ -22,83 +21,82 @@ namespace Renci.SshNet.Tests.Classes.Channels
private IList<ChannelEventArgs> _channelClosedRegister;
private List<ExceptionEventArgs> _channelExceptionRegister;
private ChannelSession _channel;
private Mock<IConnectionInfo> _connectionInfoMock;
private MockSequence _sequence;
private SemaphoreLight _sessionSemaphore;
private int _initialSessionSemaphoreCount;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint)random.Next(0, int.MaxValue);
_localWindowSize = (uint)random.Next(0, int.MaxValue);
_localPacketSize = (uint)random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint)random.Next(0, int.MaxValue);
_remoteWindowSize = (uint)random.Next(0, int.MaxValue);
_remotePacketSize = (uint)random.Next(0, int.MaxValue);
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(0, int.MaxValue);
_localPacketSize = (uint) random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint) random.Next(0, int.MaxValue);
_remoteWindowSize = (uint) random.Next(0, int.MaxValue);
_remotePacketSize = (uint) random.Next(0, int.MaxValue);
_channelClosedRegister = new List<ChannelEventArgs>();
_channelExceptionRegister = new List<ExceptionEventArgs>();
_initialSessionSemaphoreCount = random.Next(10, 20);
_sessionSemaphore = new SemaphoreLight(_initialSessionSemaphoreCount);
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
_connectionInfoMock = new Mock<IConnectionInfo>(MockBehavior.Strict);
protected override void SetupMocks()
{
_sequence = new MockSequence();
_sessionMock.InSequence(_sequence).Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object);
_connectionInfoMock.InSequence(_sequence).Setup(p => p.RetryAttempts).Returns(1);
_sessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
_sessionMock.InSequence(_sequence)
.Setup(
p =>
p.SendMessage(
It.Is<ChannelOpenMessage>(
m =>
m.LocalChannelNumber == _localChannelNumber &&
m.InitialWindowSize == _localWindowSize && m.MaximumPacketSize == _localPacketSize &&
m.Info is SessionChannelOpenInfo)));
_sessionMock.InSequence(_sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
_sessionMock.Raise(
s => s.ChannelOpenConfirmationReceived += null,
new MessageEventArgs<ChannelOpenConfirmationMessage>(
new ChannelOpenConfirmationMessage(
_localChannelNumber,
_remoteWindowSize,
_remotePacketSize,
_remoteChannelNumber)));
w.WaitOne();
});
_sessionMock.Setup(p => p.IsConnected).Returns(true);
_sessionMock.InSequence(_sequence)
.Setup(
p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber)))
.Returns(false);
_channel = new ChannelSession(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
SessionMock.InSequence(_sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(_sequence).Setup(p => p.RetryAttempts).Returns(1);
SessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
SessionMock.InSequence(_sequence)
.Setup(
p =>
p.SendMessage(
It.Is<ChannelOpenMessage>(
m =>
m.LocalChannelNumber == _localChannelNumber &&
m.InitialWindowSize == _localWindowSize && m.MaximumPacketSize == _localPacketSize &&
m.Info is SessionChannelOpenInfo)));
SessionMock.InSequence(_sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
SessionMock.Raise(
s => s.ChannelOpenConfirmationReceived += null,
new MessageEventArgs<ChannelOpenConfirmationMessage>(
new ChannelOpenConfirmationMessage(
_localChannelNumber,
_remoteWindowSize,
_remotePacketSize,
_remoteChannelNumber)));
w.WaitOne();
});
SessionMock.Setup(p => p.IsConnected).Returns(true);
SessionMock.InSequence(_sequence)
.Setup(
p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber)))
.Returns(false);
}
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelSession(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) => _channelClosedRegister.Add(args);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.Open();
_sessionMock.Raise(
SessionMock.Raise(
p => p.ChannelEofReceived += null,
new MessageEventArgs<ChannelEofMessage>(new ChannelEofMessage(_localChannelNumber)));
_sessionMock.Raise(
SessionMock.Raise(
p => p.ChannelCloseReceived += null,
new MessageEventArgs<ChannelCloseMessage>(new ChannelCloseMessage(_localChannelNumber)));
}
private void Act()
protected override void Act()
{
_channel.Dispose();
}
@@ -128,4 +126,4 @@ namespace Renci.SshNet.Tests.Classes.Channels
Assert.IsFalse(_channel.IsOpen);
}
}
}
}
@@ -11,98 +11,100 @@ using Renci.SshNet.Tests.Common;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelCloseAndChannelEofReceived_SendChannelCloseMessageSuccess
public class ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelCloseAndChannelEofReceived_SendChannelCloseMessageSuccess : ChannelSessionTestBase
{
private Mock<ISession> _sessionMock;
private uint _localChannelNumber;
private uint _localWindowSize;
private uint _localPacketSize;
private uint _remoteChannelNumber;
private uint _remoteWindowSize;
private uint _remotePacketSize;
private TimeSpan _channelCloseTimeout;
private IList<ChannelEventArgs> _channelClosedRegister;
private List<ExceptionEventArgs> _channelExceptionRegister;
private ChannelSession _channel;
private Mock<IConnectionInfo> _connectionInfoMock;
private MockSequence _sequence;
private SemaphoreLight _sessionSemaphore;
private int _initialSessionSemaphoreCount;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(0, int.MaxValue);
_localPacketSize = (uint) random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint) random.Next(0, int.MaxValue);
_remoteWindowSize = (uint) random.Next(0, int.MaxValue);
_remotePacketSize = (uint) random.Next(0, int.MaxValue);
_channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20));
_channelClosedRegister = new List<ChannelEventArgs>();
_channelExceptionRegister = new List<ExceptionEventArgs>();
_initialSessionSemaphoreCount = random.Next(10, 20);
_sessionSemaphore = new SemaphoreLight(_initialSessionSemaphoreCount);
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
_connectionInfoMock = new Mock<IConnectionInfo>(MockBehavior.Strict);
protected override void SetupMocks()
{
var sequence = new MockSequence();
_sequence = new MockSequence();
_sessionMock.InSequence(_sequence).Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object);
_connectionInfoMock.InSequence(_sequence).Setup(p => p.RetryAttempts).Returns(1);
_sessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
_sessionMock.InSequence(_sequence)
.Setup(
p =>
p.SendMessage(
It.Is<ChannelOpenMessage>(
m =>
m.LocalChannelNumber == _localChannelNumber &&
m.InitialWindowSize == _localWindowSize && m.MaximumPacketSize == _localPacketSize &&
m.Info is SessionChannelOpenInfo)));
_sessionMock.InSequence(_sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
_sessionMock.Raise(
s => s.ChannelOpenConfirmationReceived += null,
new MessageEventArgs<ChannelOpenConfirmationMessage>(
new ChannelOpenConfirmationMessage(
_localChannelNumber,
_remoteWindowSize,
_remotePacketSize,
_remoteChannelNumber)));
w.WaitOne();
});
_sessionMock.InSequence(_sequence).Setup(p => p.IsConnected).Returns(true);
_sessionMock.InSequence(_sequence)
.Setup(
p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber)))
.Returns(true);
_sessionMock.InSequence(_sequence)
.Setup(s => s.WaitOnHandle(It.IsNotNull<EventWaitHandle>()))
.Callback<WaitHandle>(w => w.WaitOne());
SessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(sequence).Setup(p => p.RetryAttempts).Returns(1);
SessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
SessionMock.InSequence(sequence)
.Setup(
p =>
p.SendMessage(
It.Is<ChannelOpenMessage>(
m =>
m.LocalChannelNumber == _localChannelNumber &&
m.InitialWindowSize == _localWindowSize && m.MaximumPacketSize == _localPacketSize &&
m.Info is SessionChannelOpenInfo)));
SessionMock.InSequence(sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
SessionMock.Raise(
s => s.ChannelOpenConfirmationReceived += null,
new MessageEventArgs<ChannelOpenConfirmationMessage>(
new ChannelOpenConfirmationMessage(
_localChannelNumber,
_remoteWindowSize,
_remotePacketSize,
_remoteChannelNumber)));
w.WaitOne();
});
SessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
SessionMock.InSequence(sequence)
.Setup(
p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber)))
.Returns(true);
SessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(sequence).Setup(p => p.ChannelCloseTimeout).Returns(_channelCloseTimeout);
SessionMock.InSequence(sequence)
.Setup(p => p.TryWait(It.IsNotNull<WaitHandle>(), _channelCloseTimeout))
.Callback<WaitHandle, TimeSpan>((waitHandle, channelCloseTimeout) => waitHandle.WaitOne())
.Returns(WaitResult.Success);
}
_channel = new ChannelSession(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelSession(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) => _channelClosedRegister.Add(args);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.Open();
_sessionMock.Raise(
SessionMock.Raise(
p => p.ChannelEofReceived += null,
new MessageEventArgs<ChannelEofMessage>(new ChannelEofMessage(_localChannelNumber)));
_sessionMock.Raise(
SessionMock.Raise(
p => p.ChannelCloseReceived += null,
new MessageEventArgs<ChannelCloseMessage>(new ChannelCloseMessage(_localChannelNumber)));
}
private void Act()
protected override void Act()
{
_channel.Dispose();
}
@@ -132,4 +134,4 @@ namespace Renci.SshNet.Tests.Classes.Channels
Assert.IsFalse(_channel.IsOpen);
}
}
}
}
@@ -10,9 +10,8 @@ using Renci.SshNet.Messages.Connection;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelCloseReceived_SendChannelCloseMessageFailure
public class ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelCloseReceived_SendChannelCloseMessageFailure : ChannelSessionTestBase
{
private Mock<ISession> _sessionMock;
private uint _localChannelNumber;
private uint _localWindowSize;
private uint _localPacketSize;
@@ -22,80 +21,79 @@ namespace Renci.SshNet.Tests.Classes.Channels
private IList<ChannelEventArgs> _channelClosedRegister;
private List<ExceptionEventArgs> _channelExceptionRegister;
private ChannelSession _channel;
private Mock<IConnectionInfo> _connectionInfoMock;
private MockSequence _sequence;
private SemaphoreLight _sessionSemaphore;
private int _initialSessionSemaphoreCount;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint)random.Next(0, int.MaxValue);
_localWindowSize = (uint)random.Next(0, int.MaxValue);
_localPacketSize = (uint)random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint)random.Next(0, int.MaxValue);
_remoteWindowSize = (uint)random.Next(0, int.MaxValue);
_remotePacketSize = (uint)random.Next(0, int.MaxValue);
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(0, int.MaxValue);
_localPacketSize = (uint) random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint) random.Next(0, int.MaxValue);
_remoteWindowSize = (uint) random.Next(0, int.MaxValue);
_remotePacketSize = (uint) random.Next(0, int.MaxValue);
_channelClosedRegister = new List<ChannelEventArgs>();
_channelExceptionRegister = new List<ExceptionEventArgs>();
_initialSessionSemaphoreCount = random.Next(10, 20);
_sessionSemaphore = new SemaphoreLight(_initialSessionSemaphoreCount);
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
_connectionInfoMock = new Mock<IConnectionInfo>(MockBehavior.Strict);
protected override void SetupMocks()
{
_sequence = new MockSequence();
_sessionMock.InSequence(_sequence).Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object);
_connectionInfoMock.InSequence(_sequence).Setup(p => p.RetryAttempts).Returns(1);
_sessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
_sessionMock.InSequence(_sequence)
.Setup(
p =>
p.SendMessage(
It.Is<ChannelOpenMessage>(
m =>
m.LocalChannelNumber == _localChannelNumber &&
m.InitialWindowSize == _localWindowSize && m.MaximumPacketSize == _localPacketSize &&
m.Info is SessionChannelOpenInfo)));
_sessionMock.InSequence(_sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
_sessionMock.Raise(
s => s.ChannelOpenConfirmationReceived += null,
new MessageEventArgs<ChannelOpenConfirmationMessage>(
new ChannelOpenConfirmationMessage(
_localChannelNumber,
_remoteWindowSize,
_remotePacketSize,
_remoteChannelNumber)));
w.WaitOne();
});
_sessionMock.Setup(p => p.IsConnected).Returns(true);
_sessionMock.InSequence(_sequence)
.Setup(
p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber)))
.Returns(false);
_channel = new ChannelSession(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
SessionMock.InSequence(_sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(_sequence).Setup(p => p.RetryAttempts).Returns(1);
SessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
SessionMock.InSequence(_sequence)
.Setup(
p =>
p.SendMessage(
It.Is<ChannelOpenMessage>(
m =>
m.LocalChannelNumber == _localChannelNumber &&
m.InitialWindowSize == _localWindowSize && m.MaximumPacketSize == _localPacketSize &&
m.Info is SessionChannelOpenInfo)));
SessionMock.InSequence(_sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
SessionMock.Raise(
s => s.ChannelOpenConfirmationReceived += null,
new MessageEventArgs<ChannelOpenConfirmationMessage>(
new ChannelOpenConfirmationMessage(
_localChannelNumber,
_remoteWindowSize,
_remotePacketSize,
_remoteChannelNumber)));
w.WaitOne();
});
SessionMock.Setup(p => p.IsConnected).Returns(true);
SessionMock.InSequence(_sequence)
.Setup(
p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber)))
.Returns(false);
}
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelSession(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) => _channelClosedRegister.Add(args);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.Open();
_sessionMock.Raise(
SessionMock.Raise(
p => p.ChannelCloseReceived += null,
new MessageEventArgs<ChannelCloseMessage>(new ChannelCloseMessage(_localChannelNumber)));
}
private void Act()
protected override void Act()
{
_channel.Dispose();
}
@@ -125,4 +123,4 @@ namespace Renci.SshNet.Tests.Classes.Channels
Assert.IsFalse(_channel.IsOpen);
}
}
}
}
@@ -11,52 +11,46 @@ using Renci.SshNet.Tests.Common;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelCloseReceived_SendChannelCloseMessageSuccess
public class ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelCloseReceived_SendChannelCloseMessageSuccess : ChannelSessionTestBase
{
private Mock<ISession> _sessionMock;
private uint _localChannelNumber;
private uint _localWindowSize;
private uint _localPacketSize;
private uint _remoteChannelNumber;
private uint _remoteWindowSize;
private uint _remotePacketSize;
private TimeSpan _channelCloseTimeout;
private IList<ChannelEventArgs> _channelClosedRegister;
private List<ExceptionEventArgs> _channelExceptionRegister;
private ChannelSession _channel;
private Mock<IConnectionInfo> _connectionInfoMock;
private MockSequence _sequence;
private SemaphoreLight _sessionSemaphore;
private int _initialSessionSemaphoreCount;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(0, int.MaxValue);
_localPacketSize = (uint) random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint) random.Next(0, int.MaxValue);
_remoteWindowSize = (uint) random.Next(0, int.MaxValue);
_remotePacketSize = (uint) random.Next(0, int.MaxValue);
_channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20));
_channelClosedRegister = new List<ChannelEventArgs>();
_channelExceptionRegister = new List<ExceptionEventArgs>();
_initialSessionSemaphoreCount = random.Next(10, 20);
_sessionSemaphore = new SemaphoreLight(_initialSessionSemaphoreCount);
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
_connectionInfoMock = new Mock<IConnectionInfo>(MockBehavior.Strict);
protected override void SetupMocks()
{
var sequence = new MockSequence();
_sequence = new MockSequence();
_sessionMock.InSequence(_sequence).Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object);
_connectionInfoMock.InSequence(_sequence).Setup(p => p.RetryAttempts).Returns(1);
_sessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
_sessionMock.InSequence(_sequence)
SessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(sequence).Setup(p => p.RetryAttempts).Returns(1);
SessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
SessionMock.InSequence(sequence)
.Setup(
p =>
p.SendMessage(
@@ -65,12 +59,12 @@ namespace Renci.SshNet.Tests.Classes.Channels
m.LocalChannelNumber == _localChannelNumber &&
m.InitialWindowSize == _localWindowSize && m.MaximumPacketSize == _localPacketSize &&
m.Info is SessionChannelOpenInfo)));
_sessionMock.InSequence(_sequence)
SessionMock.InSequence(sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
_sessionMock.Raise(
SessionMock.Raise(
s => s.ChannelOpenConfirmationReceived += null,
new MessageEventArgs<ChannelOpenConfirmationMessage>(
new ChannelOpenConfirmationMessage(
@@ -80,26 +74,34 @@ namespace Renci.SshNet.Tests.Classes.Channels
_remoteChannelNumber)));
w.WaitOne();
});
_sessionMock.InSequence(_sequence).Setup(p => p.IsConnected).Returns(true);
_sessionMock.InSequence(_sequence)
SessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
SessionMock.InSequence(sequence)
.Setup(
p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber)))
.Returns(true);
_sessionMock.InSequence(_sequence)
.Setup(s => s.WaitOnHandle(It.IsNotNull<EventWaitHandle>()))
.Callback<WaitHandle>(w => w.WaitOne());
SessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(sequence).Setup(p => p.ChannelCloseTimeout).Returns(_channelCloseTimeout);
SessionMock.InSequence(sequence)
.Setup(p => p.TryWait(It.IsNotNull<WaitHandle>(), _channelCloseTimeout))
.Callback<WaitHandle, TimeSpan>((waitHandle, channelCloseTimeout) => waitHandle.WaitOne())
.Returns(WaitResult.Success);
}
_channel = new ChannelSession(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelSession(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) => _channelClosedRegister.Add(args);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.Open();
_sessionMock.Raise(
SessionMock.Raise(
p => p.ChannelCloseReceived += null,
new MessageEventArgs<ChannelCloseMessage>(new ChannelCloseMessage(_localChannelNumber)));
}
private void Act()
protected override void Act()
{
_channel.Dispose();
}
@@ -10,9 +10,8 @@ using Renci.SshNet.Messages.Connection;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelEofReceived_SendChannelCloseMessageFailure
public class ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelEofReceived_SendChannelCloseMessageFailure : ChannelSessionTestBase
{
private Mock<ISession> _sessionMock;
private uint _localChannelNumber;
private uint _localWindowSize;
private uint _localPacketSize;
@@ -22,80 +21,78 @@ namespace Renci.SshNet.Tests.Classes.Channels
private IList<ChannelEventArgs> _channelClosedRegister;
private List<ExceptionEventArgs> _channelExceptionRegister;
private ChannelSession _channel;
private Mock<IConnectionInfo> _connectionInfoMock;
private MockSequence _sequence;
private SemaphoreLight _sessionSemaphore;
private int _initialSessionSemaphoreCount;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint)random.Next(0, int.MaxValue);
_localWindowSize = (uint)random.Next(0, int.MaxValue);
_localPacketSize = (uint)random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint)random.Next(0, int.MaxValue);
_remoteWindowSize = (uint)random.Next(0, int.MaxValue);
_remotePacketSize = (uint)random.Next(0, int.MaxValue);
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(0, int.MaxValue);
_localPacketSize = (uint) random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint) random.Next(0, int.MaxValue);
_remoteWindowSize = (uint) random.Next(0, int.MaxValue);
_remotePacketSize = (uint) random.Next(0, int.MaxValue);
_channelClosedRegister = new List<ChannelEventArgs>();
_channelExceptionRegister = new List<ExceptionEventArgs>();
_initialSessionSemaphoreCount = random.Next(10, 20);
_sessionSemaphore = new SemaphoreLight(_initialSessionSemaphoreCount);
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
_connectionInfoMock = new Mock<IConnectionInfo>(MockBehavior.Strict);
protected override void SetupMocks()
{
_sequence = new MockSequence();
_sessionMock.InSequence(_sequence).Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object);
_connectionInfoMock.InSequence(_sequence).Setup(p => p.RetryAttempts).Returns(1);
_sessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
_sessionMock.InSequence(_sequence)
.Setup(
p =>
p.SendMessage(
It.Is<ChannelOpenMessage>(
m =>
m.LocalChannelNumber == _localChannelNumber &&
m.InitialWindowSize == _localWindowSize && m.MaximumPacketSize == _localPacketSize &&
m.Info is SessionChannelOpenInfo)));
_sessionMock.InSequence(_sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
_sessionMock.Raise(
s => s.ChannelOpenConfirmationReceived += null,
new MessageEventArgs<ChannelOpenConfirmationMessage>(
new ChannelOpenConfirmationMessage(
_localChannelNumber,
_remoteWindowSize,
_remotePacketSize,
_remoteChannelNumber)));
w.WaitOne();
});
_sessionMock.Setup(p => p.IsConnected).Returns(true);
_sessionMock.InSequence(_sequence)
.Setup(
p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber)))
.Returns(false);
SessionMock.InSequence(_sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(_sequence).Setup(p => p.RetryAttempts).Returns(1);
SessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
SessionMock.InSequence(_sequence)
.Setup(
p =>
p.SendMessage(
It.Is<ChannelOpenMessage>(
m =>
m.LocalChannelNumber == _localChannelNumber &&
m.InitialWindowSize == _localWindowSize && m.MaximumPacketSize == _localPacketSize &&
m.Info is SessionChannelOpenInfo)));
SessionMock.InSequence(_sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
SessionMock.Raise(
s => s.ChannelOpenConfirmationReceived += null,
new MessageEventArgs<ChannelOpenConfirmationMessage>(
new ChannelOpenConfirmationMessage(
_localChannelNumber,
_remoteWindowSize,
_remotePacketSize,
_remoteChannelNumber)));
w.WaitOne();
});
SessionMock.Setup(p => p.IsConnected).Returns(true);
SessionMock.InSequence(_sequence)
.Setup(
p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber)))
.Returns(false);
}
_channel = new ChannelSession(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelSession(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) => _channelClosedRegister.Add(args);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.Open();
_sessionMock.Raise(
SessionMock.Raise(
p => p.ChannelEofReceived += null,
new MessageEventArgs<ChannelEofMessage>(new ChannelEofMessage(_localChannelNumber)));
}
private void Act()
protected override void Act()
{
_channel.Dispose();
}
@@ -124,4 +121,4 @@ namespace Renci.SshNet.Tests.Classes.Channels
Assert.IsFalse(_channel.IsOpen);
}
}
}
}
@@ -10,52 +10,46 @@ using Renci.SshNet.Messages.Connection;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelEofReceived_SendChannelCloseMessageSuccess
public class ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_ChannelEofReceived_SendChannelCloseMessageSuccess : ChannelSessionTestBase
{
private Mock<ISession> _sessionMock;
private uint _localChannelNumber;
private uint _localWindowSize;
private uint _localPacketSize;
private uint _remoteChannelNumber;
private uint _remoteWindowSize;
private uint _remotePacketSize;
private TimeSpan _channelCloseTimeout;
private IList<ChannelEventArgs> _channelClosedRegister;
private List<ExceptionEventArgs> _channelExceptionRegister;
private ChannelSession _channel;
private Mock<IConnectionInfo> _connectionInfoMock;
private MockSequence _sequence;
private SemaphoreLight _sessionSemaphore;
private int _initialSessionSemaphoreCount;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(0, int.MaxValue);
_localPacketSize = (uint) random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint) random.Next(0, int.MaxValue);
_remoteWindowSize = (uint) random.Next(0, int.MaxValue);
_remotePacketSize = (uint) random.Next(0, int.MaxValue);
_channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20));
_channelClosedRegister = new List<ChannelEventArgs>();
_channelExceptionRegister = new List<ExceptionEventArgs>();
_initialSessionSemaphoreCount = random.Next(10, 20);
_sessionSemaphore = new SemaphoreLight(_initialSessionSemaphoreCount);
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
_connectionInfoMock = new Mock<IConnectionInfo>(MockBehavior.Strict);
protected override void SetupMocks()
{
var sequence = new MockSequence();
_sequence = new MockSequence();
_sessionMock.InSequence(_sequence).Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object);
_connectionInfoMock.InSequence(_sequence).Setup(p => p.RetryAttempts).Returns(1);
_sessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
_sessionMock.InSequence(_sequence)
SessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(sequence).Setup(p => p.RetryAttempts).Returns(1);
SessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
SessionMock.InSequence(sequence)
.Setup(
p =>
p.SendMessage(
@@ -64,12 +58,12 @@ namespace Renci.SshNet.Tests.Classes.Channels
m.LocalChannelNumber == _localChannelNumber &&
m.InitialWindowSize == _localWindowSize && m.MaximumPacketSize == _localPacketSize &&
m.Info is SessionChannelOpenInfo)));
_sessionMock.InSequence(_sequence)
SessionMock.InSequence(sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
_sessionMock.Raise(
SessionMock.Raise(
s => s.ChannelOpenConfirmationReceived += null,
new MessageEventArgs<ChannelOpenConfirmationMessage>(
new ChannelOpenConfirmationMessage(
@@ -79,33 +73,41 @@ namespace Renci.SshNet.Tests.Classes.Channels
_remoteChannelNumber)));
w.WaitOne();
});
_sessionMock.Setup(p => p.IsConnected).Returns(true);
_sessionMock.InSequence(_sequence)
SessionMock.Setup(p => p.IsConnected).Returns(true);
SessionMock.InSequence(sequence)
.Setup(
p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber)))
.Returns(true);
_sessionMock.InSequence(_sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
_sessionMock.Raise(
s => s.ChannelCloseReceived += null,
new MessageEventArgs<ChannelCloseMessage>(new ChannelCloseMessage(_localChannelNumber)));
w.WaitOne();
});
SessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(sequence).Setup(p => p.ChannelCloseTimeout).Returns(_channelCloseTimeout);
SessionMock.InSequence(sequence)
.Setup(p => p.TryWait(It.IsNotNull<WaitHandle>(), _channelCloseTimeout))
.Callback<WaitHandle, TimeSpan>(
(waitHandle, channelCloseTimeout) =>
{
SessionMock.Raise(
s => s.ChannelCloseReceived += null,
new MessageEventArgs<ChannelCloseMessage>(new ChannelCloseMessage(_localChannelNumber)));
waitHandle.WaitOne();
})
.Returns(WaitResult.Success);
}
_channel = new ChannelSession(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelSession(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) => _channelClosedRegister.Add(args);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.Open();
_sessionMock.Raise(
SessionMock.Raise(
p => p.ChannelEofReceived += null,
new MessageEventArgs<ChannelEofMessage>(new ChannelEofMessage(_localChannelNumber)));
}
private void Act()
protected override void Act()
{
_channel.Dispose();
}
@@ -10,10 +10,8 @@ using Renci.SshNet.Messages.Connection;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_NoChannelCloseOrChannelEofReceived
public class ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_NoChannelCloseOrChannelEofReceived : ChannelSessionTestBase
{
private Mock<ISession> _sessionMock;
private Mock<IConnectionInfo> _connectionInfoMock;
private ChannelSession _channel;
private uint _localChannelNumber;
private uint _localWindowSize;
@@ -21,89 +19,94 @@ namespace Renci.SshNet.Tests.Classes.Channels
private uint _remoteWindowSize;
private uint _remotePacketSize;
private uint _remoteChannelNumber;
private TimeSpan _channelCloseTimeout;
private SemaphoreLight _sessionSemaphore;
private IList<ChannelEventArgs> _channelClosedRegister;
private List<ExceptionEventArgs> _channelExceptionRegister;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint)random.Next(0, int.MaxValue);
_localWindowSize = (uint)random.Next(2000, 3000);
_localPacketSize = (uint)random.Next(1000, 2000);
_remoteChannelNumber = (uint)random.Next(0, int.MaxValue);
_remoteWindowSize = (uint)random.Next(0, int.MaxValue);
_remotePacketSize = (uint)random.Next(100, 200);
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(2000, 3000);
_localPacketSize = (uint) random.Next(1000, 2000);
_remoteChannelNumber = (uint) random.Next(0, int.MaxValue);
_remoteWindowSize = (uint) random.Next(0, int.MaxValue);
_remotePacketSize = (uint) random.Next(100, 200);
_channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20));
_sessionSemaphore = new SemaphoreLight(1);
_channelClosedRegister = new List<ChannelEventArgs>();
_channelExceptionRegister = new List<ExceptionEventArgs>();
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
_connectionInfoMock = new Mock<IConnectionInfo>(MockBehavior.Strict);
protected override void SetupMocks()
{
var sequence = new MockSequence();
_sessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object);
_connectionInfoMock.InSequence(sequence).Setup(p => p.RetryAttempts).Returns(1);
_sessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
_sessionMock.InSequence(sequence)
.Setup(
p =>
p.SendMessage(
It.Is<ChannelOpenMessage>(
m =>
m.LocalChannelNumber == _localChannelNumber &&
m.InitialWindowSize == _localWindowSize && m.MaximumPacketSize == _localPacketSize &&
m.Info is SessionChannelOpenInfo)));
_sessionMock.InSequence(sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
_sessionMock.Raise(
s => s.ChannelOpenConfirmationReceived += null,
new MessageEventArgs<ChannelOpenConfirmationMessage>(
new ChannelOpenConfirmationMessage(
_localChannelNumber,
_remoteWindowSize,
_remotePacketSize,
_remoteChannelNumber)));
w.WaitOne();
});
_sessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
_sessionMock.InSequence(sequence)
.Setup(
p => p.TrySendMessage(It.Is<ChannelEofMessage>(m => m.LocalChannelNumber == _remoteChannelNumber)))
.Returns(true);
_sessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
_sessionMock.InSequence(sequence)
.Setup(
p => p.TrySendMessage(It.Is<ChannelCloseMessage>(m => m.LocalChannelNumber == _remoteChannelNumber)))
.Returns(true);
_sessionMock.InSequence(sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
_sessionMock.Raise(
s => s.ChannelCloseReceived += null,
new MessageEventArgs<ChannelCloseMessage>(new ChannelCloseMessage(_localChannelNumber)));
w.WaitOne();
});
_channel = new ChannelSession(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
SessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(sequence).Setup(p => p.RetryAttempts).Returns(1);
SessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
SessionMock.InSequence(sequence)
.Setup(
p =>
p.SendMessage(
It.Is<ChannelOpenMessage>(
m =>
m.LocalChannelNumber == _localChannelNumber &&
m.InitialWindowSize == _localWindowSize && m.MaximumPacketSize == _localPacketSize &&
m.Info is SessionChannelOpenInfo)));
SessionMock.InSequence(sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
SessionMock.Raise(
s => s.ChannelOpenConfirmationReceived += null,
new MessageEventArgs<ChannelOpenConfirmationMessage>(
new ChannelOpenConfirmationMessage(
_localChannelNumber,
_remoteWindowSize,
_remotePacketSize,
_remoteChannelNumber)));
w.WaitOne();
});
SessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
SessionMock.InSequence(sequence)
.Setup(
p => p.TrySendMessage(It.Is<ChannelEofMessage>(m => m.LocalChannelNumber == _remoteChannelNumber)))
.Returns(true);
SessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
SessionMock.InSequence(sequence)
.Setup(
p => p.TrySendMessage(It.Is<ChannelCloseMessage>(m => m.LocalChannelNumber == _remoteChannelNumber)))
.Returns(true);
SessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(sequence).Setup(p => p.ChannelCloseTimeout).Returns(_channelCloseTimeout);
SessionMock.InSequence(sequence)
.Setup(p => p.TryWait(It.IsNotNull<WaitHandle>(), _channelCloseTimeout))
.Callback<WaitHandle, TimeSpan>(
(waitHandle, channelCloseTimeout) =>
{
SessionMock.Raise(
s => s.ChannelCloseReceived += null,
new MessageEventArgs<ChannelCloseMessage>(new ChannelCloseMessage(_localChannelNumber)));
waitHandle.WaitOne();
})
.Returns(WaitResult.Success);
}
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelSession(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) => _channelClosedRegister.Add(args);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.Open();
}
private void Act()
protected override void Act()
{
_channel.Dispose();
}
@@ -111,13 +114,13 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ChannelEofMessageShouldBeSentOnce()
{
_sessionMock.Verify(p => p.TrySendMessage(It.Is<ChannelEofMessage>(m => m.LocalChannelNumber == _remoteChannelNumber)), Times.Once);
SessionMock.Verify(p => p.TrySendMessage(It.Is<ChannelEofMessage>(m => m.LocalChannelNumber == _remoteChannelNumber)), Times.Once);
}
[TestMethod]
public void ChannelCloseMessageShouldBeSentOnce()
{
_sessionMock.Verify(p => p.TrySendMessage(It.Is<ChannelCloseMessage>(m => m.LocalChannelNumber == _remoteChannelNumber)), Times.Once);
SessionMock.Verify(p => p.TrySendMessage(It.Is<ChannelCloseMessage>(m => m.LocalChannelNumber == _remoteChannelNumber)), Times.Once);
}
[TestMethod]
@@ -10,10 +10,8 @@ using Renci.SshNet.Messages.Connection;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_NoChannelCloseOrChannelEofReceived_SendChannelEofMessageFailure
public class ChannelSessionTest_Dispose_SessionIsConnectedAndChannelIsOpen_NoChannelCloseOrChannelEofReceived_SendChannelEofMessageFailure : ChannelSessionTestBase
{
private Mock<ISession> _sessionMock;
private Mock<IConnectionInfo> _connectionInfoMock;
private ChannelSession _channel;
private uint _localChannelNumber;
private uint _localWindowSize;
@@ -21,89 +19,93 @@ namespace Renci.SshNet.Tests.Classes.Channels
private uint _remoteWindowSize;
private uint _remotePacketSize;
private uint _remoteChannelNumber;
private TimeSpan _channelCloseTimeout;
private SemaphoreLight _sessionSemaphore;
private IList<ChannelEventArgs> _channelClosedRegister;
private List<ExceptionEventArgs> _channelExceptionRegister;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint)random.Next(0, int.MaxValue);
_localWindowSize = (uint)random.Next(2000, 3000);
_localPacketSize = (uint)random.Next(1000, 2000);
_remoteChannelNumber = (uint)random.Next(0, int.MaxValue);
_remoteWindowSize = (uint)random.Next(0, int.MaxValue);
_remotePacketSize = (uint)random.Next(100, 200);
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(2000, 3000);
_localPacketSize = (uint) random.Next(1000, 2000);
_remoteChannelNumber = (uint) random.Next(0, int.MaxValue);
_remoteWindowSize = (uint) random.Next(0, int.MaxValue);
_remotePacketSize = (uint) random.Next(100, 200);
_channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20));
_sessionSemaphore = new SemaphoreLight(1);
_channelClosedRegister = new List<ChannelEventArgs>();
_channelExceptionRegister = new List<ExceptionEventArgs>();
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
_connectionInfoMock = new Mock<IConnectionInfo>(MockBehavior.Strict);
protected override void SetupMocks()
{
var sequence = new MockSequence();
_sessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object);
_connectionInfoMock.InSequence(sequence).Setup(p => p.RetryAttempts).Returns(1);
_sessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
_sessionMock.InSequence(sequence)
.Setup(
p =>
p.SendMessage(
It.Is<ChannelOpenMessage>(
m =>
m.LocalChannelNumber == _localChannelNumber &&
m.InitialWindowSize == _localWindowSize && m.MaximumPacketSize == _localPacketSize &&
m.Info is SessionChannelOpenInfo)));
_sessionMock.InSequence(sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
_sessionMock.Raise(
s => s.ChannelOpenConfirmationReceived += null,
new MessageEventArgs<ChannelOpenConfirmationMessage>(
new ChannelOpenConfirmationMessage(
_localChannelNumber,
_remoteWindowSize,
_remotePacketSize,
_remoteChannelNumber)));
w.WaitOne();
});
_sessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
_sessionMock.InSequence(sequence)
.Setup(
p => p.TrySendMessage(It.Is<ChannelEofMessage>(m => m.LocalChannelNumber == _remoteChannelNumber)))
.Returns(false);
_sessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
_sessionMock.InSequence(sequence)
.Setup(
p => p.TrySendMessage(It.Is<ChannelCloseMessage>(m => m.LocalChannelNumber == _remoteChannelNumber)))
.Returns(true);
_sessionMock.InSequence(sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
_sessionMock.Raise(
s => s.ChannelCloseReceived += null,
new MessageEventArgs<ChannelCloseMessage>(new ChannelCloseMessage(_localChannelNumber)));
w.WaitOne();
});
_channel = new ChannelSession(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
SessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(sequence).Setup(p => p.RetryAttempts).Returns(1);
SessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
SessionMock.InSequence(sequence)
.Setup(
p =>
p.SendMessage(
It.Is<ChannelOpenMessage>(
m =>
m.LocalChannelNumber == _localChannelNumber &&
m.InitialWindowSize == _localWindowSize && m.MaximumPacketSize == _localPacketSize &&
m.Info is SessionChannelOpenInfo)));
SessionMock.InSequence(sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
SessionMock.Raise(
s => s.ChannelOpenConfirmationReceived += null,
new MessageEventArgs<ChannelOpenConfirmationMessage>(
new ChannelOpenConfirmationMessage(
_localChannelNumber,
_remoteWindowSize,
_remotePacketSize,
_remoteChannelNumber)));
w.WaitOne();
});
SessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
SessionMock.InSequence(sequence)
.Setup(
p => p.TrySendMessage(It.Is<ChannelEofMessage>(m => m.LocalChannelNumber == _remoteChannelNumber)))
.Returns(false);
SessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
SessionMock.InSequence(sequence)
.Setup(
p => p.TrySendMessage(It.Is<ChannelCloseMessage>(m => m.LocalChannelNumber == _remoteChannelNumber)))
.Returns(true);
SessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(sequence).Setup(p => p.ChannelCloseTimeout).Returns(_channelCloseTimeout);
SessionMock.InSequence(sequence)
.Setup(p => p.TryWait(It.IsNotNull<WaitHandle>(), _channelCloseTimeout))
.Callback<WaitHandle, TimeSpan>(
(waitHandle, channelCloseTimeout) =>
{
SessionMock.Raise(s => s.ChannelCloseReceived += null,
new MessageEventArgs<ChannelCloseMessage>(new ChannelCloseMessage(_localChannelNumber)));
waitHandle.WaitOne();
})
.Returns(WaitResult.Success);
}
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelSession(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) => _channelClosedRegister.Add(args);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.Open();
}
private void Act()
protected override void Act()
{
_channel.Dispose();
}
@@ -111,13 +113,13 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ChannelEofMessageShouldBeSentOnce()
{
_sessionMock.Verify(p => p.TrySendMessage(It.Is<ChannelEofMessage>(m => m.LocalChannelNumber == _remoteChannelNumber)), Times.Once);
SessionMock.Verify(p => p.TrySendMessage(It.Is<ChannelEofMessage>(m => m.LocalChannelNumber == _remoteChannelNumber)), Times.Once);
}
[TestMethod]
public void ChannelCloseMessageShouldBeSentOnce()
{
_sessionMock.Verify(p => p.TrySendMessage(It.Is<ChannelCloseMessage>(m => m.LocalChannelNumber == _remoteChannelNumber)), Times.Once);
SessionMock.Verify(p => p.TrySendMessage(It.Is<ChannelCloseMessage>(m => m.LocalChannelNumber == _remoteChannelNumber)), Times.Once);
}
[TestMethod]
@@ -10,9 +10,8 @@ using Renci.SshNet.Messages.Connection;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelSessionTest_Dispose_SessionIsNotConnectedAndChannelIsOpen_ChannelCloseAndChannelEofReceived
public class ChannelSessionTest_Dispose_SessionIsNotConnectedAndChannelIsOpen_ChannelCloseAndChannelEofReceived : ChannelSessionTestBase
{
private Mock<ISession> _sessionMock;
private uint _localChannelNumber;
private uint _localWindowSize;
private uint _localPacketSize;
@@ -22,79 +21,78 @@ namespace Renci.SshNet.Tests.Classes.Channels
private IList<ChannelEventArgs> _channelClosedRegister;
private List<ExceptionEventArgs> _channelExceptionRegister;
private ChannelSession _channel;
private Mock<IConnectionInfo> _connectionInfoMock;
private MockSequence _sequence;
private SemaphoreLight _sessionSemaphore;
private int _initialSessionSemaphoreCount;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint)random.Next(0, int.MaxValue);
_localWindowSize = (uint)random.Next(0, int.MaxValue);
_localPacketSize = (uint)random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint)random.Next(0, int.MaxValue);
_remoteWindowSize = (uint)random.Next(0, int.MaxValue);
_remotePacketSize = (uint)random.Next(0, int.MaxValue);
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(0, int.MaxValue);
_localPacketSize = (uint) random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint) random.Next(0, int.MaxValue);
_remoteWindowSize = (uint) random.Next(0, int.MaxValue);
_remotePacketSize = (uint) random.Next(0, int.MaxValue);
_channelClosedRegister = new List<ChannelEventArgs>();
_channelExceptionRegister = new List<ExceptionEventArgs>();
_initialSessionSemaphoreCount = random.Next(10, 20);
_sessionSemaphore = new SemaphoreLight(_initialSessionSemaphoreCount);
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
_connectionInfoMock = new Mock<IConnectionInfo>(MockBehavior.Strict);
protected override void SetupMocks()
{
_sequence = new MockSequence();
_sessionMock.InSequence(_sequence).Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object);
_connectionInfoMock.InSequence(_sequence).Setup(p => p.RetryAttempts).Returns(1);
_sessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
_sessionMock.InSequence(_sequence)
.Setup(
p =>
p.SendMessage(
It.Is<ChannelOpenMessage>(
m =>
m.LocalChannelNumber == _localChannelNumber &&
m.InitialWindowSize == _localWindowSize && m.MaximumPacketSize == _localPacketSize &&
m.Info is SessionChannelOpenInfo)));
_sessionMock.InSequence(_sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
_sessionMock.Raise(
s => s.ChannelOpenConfirmationReceived += null,
new MessageEventArgs<ChannelOpenConfirmationMessage>(
new ChannelOpenConfirmationMessage(
_localChannelNumber,
_remoteWindowSize,
_remotePacketSize,
_remoteChannelNumber)));
w.WaitOne();
});
_sessionMock.Setup(p => p.IsConnected).Returns(false);
_channel = new ChannelSession(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
SessionMock.InSequence(_sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(_sequence).Setup(p => p.RetryAttempts).Returns(1);
SessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
SessionMock.InSequence(_sequence)
.Setup(
p =>
p.SendMessage(
It.Is<ChannelOpenMessage>(
m =>
m.LocalChannelNumber == _localChannelNumber &&
m.InitialWindowSize == _localWindowSize && m.MaximumPacketSize == _localPacketSize &&
m.Info is SessionChannelOpenInfo)));
SessionMock.InSequence(_sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
SessionMock.Raise(
s => s.ChannelOpenConfirmationReceived += null,
new MessageEventArgs<ChannelOpenConfirmationMessage>(
new ChannelOpenConfirmationMessage(
_localChannelNumber,
_remoteWindowSize,
_remotePacketSize,
_remoteChannelNumber)));
w.WaitOne();
});
SessionMock.Setup(p => p.IsConnected).Returns(false);
}
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelSession(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) => _channelClosedRegister.Add(args);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.Open();
_sessionMock.Raise(
SessionMock.Raise(
p => p.ChannelEofReceived += null,
new MessageEventArgs<ChannelEofMessage>(new ChannelEofMessage(_localChannelNumber)));
_sessionMock.Raise(
SessionMock.Raise(
p => p.ChannelCloseReceived += null,
new MessageEventArgs<ChannelCloseMessage>(new ChannelCloseMessage(_localChannelNumber)));
}
private void Act()
protected override void Act()
{
_channel.Dispose();
}
@@ -124,4 +122,4 @@ namespace Renci.SshNet.Tests.Classes.Channels
Assert.IsFalse(_channel.IsOpen);
}
}
}
}
@@ -10,9 +10,8 @@ using Renci.SshNet.Messages.Connection;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelSessionTest_Dispose_SessionIsNotConnectedAndChannelIsOpen_ChannelCloseReceived
public class ChannelSessionTest_Dispose_SessionIsNotConnectedAndChannelIsOpen_ChannelCloseReceived : ChannelSessionTestBase
{
private Mock<ISession> _sessionMock;
private uint _localChannelNumber;
private uint _localWindowSize;
private uint _localPacketSize;
@@ -22,76 +21,75 @@ namespace Renci.SshNet.Tests.Classes.Channels
private IList<ChannelEventArgs> _channelClosedRegister;
private List<ExceptionEventArgs> _channelExceptionRegister;
private ChannelSession _channel;
private Mock<IConnectionInfo> _connectionInfoMock;
private MockSequence _sequence;
private SemaphoreLight _sessionSemaphore;
private int _initialSessionSemaphoreCount;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint)random.Next(0, int.MaxValue);
_localWindowSize = (uint)random.Next(0, int.MaxValue);
_localPacketSize = (uint)random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint)random.Next(0, int.MaxValue);
_remoteWindowSize = (uint)random.Next(0, int.MaxValue);
_remotePacketSize = (uint)random.Next(0, int.MaxValue);
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(0, int.MaxValue);
_localPacketSize = (uint) random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint) random.Next(0, int.MaxValue);
_remoteWindowSize = (uint) random.Next(0, int.MaxValue);
_remotePacketSize = (uint) random.Next(0, int.MaxValue);
_channelClosedRegister = new List<ChannelEventArgs>();
_channelExceptionRegister = new List<ExceptionEventArgs>();
_initialSessionSemaphoreCount = random.Next(10, 20);
_sessionSemaphore = new SemaphoreLight(_initialSessionSemaphoreCount);
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
_connectionInfoMock = new Mock<IConnectionInfo>(MockBehavior.Strict);
protected override void SetupMocks()
{
_sequence = new MockSequence();
_sessionMock.InSequence(_sequence).Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object);
_connectionInfoMock.InSequence(_sequence).Setup(p => p.RetryAttempts).Returns(1);
_sessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
_sessionMock.InSequence(_sequence)
.Setup(
p =>
p.SendMessage(
It.Is<ChannelOpenMessage>(
m =>
m.LocalChannelNumber == _localChannelNumber &&
m.InitialWindowSize == _localWindowSize && m.MaximumPacketSize == _localPacketSize &&
m.Info is SessionChannelOpenInfo)));
_sessionMock.InSequence(_sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
_sessionMock.Raise(
s => s.ChannelOpenConfirmationReceived += null,
new MessageEventArgs<ChannelOpenConfirmationMessage>(
new ChannelOpenConfirmationMessage(
_localChannelNumber,
_remoteWindowSize,
_remotePacketSize,
_remoteChannelNumber)));
w.WaitOne();
});
_sessionMock.Setup(p => p.IsConnected).Returns(false);
_channel = new ChannelSession(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
SessionMock.InSequence(_sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(_sequence).Setup(p => p.RetryAttempts).Returns(1);
SessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
SessionMock.InSequence(_sequence)
.Setup(
p =>
p.SendMessage(
It.Is<ChannelOpenMessage>(
m =>
m.LocalChannelNumber == _localChannelNumber &&
m.InitialWindowSize == _localWindowSize && m.MaximumPacketSize == _localPacketSize &&
m.Info is SessionChannelOpenInfo)));
SessionMock.InSequence(_sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
SessionMock.Raise(
s => s.ChannelOpenConfirmationReceived += null,
new MessageEventArgs<ChannelOpenConfirmationMessage>(
new ChannelOpenConfirmationMessage(
_localChannelNumber,
_remoteWindowSize,
_remotePacketSize,
_remoteChannelNumber)));
w.WaitOne();
});
SessionMock.Setup(p => p.IsConnected).Returns(false);
}
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelSession(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) => _channelClosedRegister.Add(args);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.Open();
_sessionMock.Raise(
SessionMock.Raise(
p => p.ChannelCloseReceived += null,
new MessageEventArgs<ChannelCloseMessage>(new ChannelCloseMessage(_localChannelNumber)));
}
private void Act()
protected override void Act()
{
_channel.Dispose();
}
@@ -121,4 +119,4 @@ namespace Renci.SshNet.Tests.Classes.Channels
Assert.IsFalse(_channel.IsOpen);
}
}
}
}
@@ -10,9 +10,8 @@ using Renci.SshNet.Messages.Connection;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelSessionTest_Dispose_SessionIsNotConnectedAndChannelIsOpen_NoChannelCloseOrChannelEofReceived
public class ChannelSessionTest_Dispose_SessionIsNotConnectedAndChannelIsOpen_NoChannelCloseOrChannelEofReceived : ChannelSessionTestBase
{
private Mock<ISession> _sessionMock;
private uint _localChannelNumber;
private uint _localWindowSize;
private uint _localPacketSize;
@@ -22,72 +21,70 @@ namespace Renci.SshNet.Tests.Classes.Channels
private IList<ChannelEventArgs> _channelClosedRegister;
private List<ExceptionEventArgs> _channelExceptionRegister;
private ChannelSession _channel;
private Mock<IConnectionInfo> _connectionInfoMock;
private MockSequence _sequence;
private SemaphoreLight _sessionSemaphore;
private int _initialSessionSemaphoreCount;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint)random.Next(0, int.MaxValue);
_localWindowSize = (uint)random.Next(0, int.MaxValue);
_localPacketSize = (uint)random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint)random.Next(0, int.MaxValue);
_remoteWindowSize = (uint)random.Next(0, int.MaxValue);
_remotePacketSize = (uint)random.Next(0, int.MaxValue);
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(0, int.MaxValue);
_localPacketSize = (uint) random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint) random.Next(0, int.MaxValue);
_remoteWindowSize = (uint) random.Next(0, int.MaxValue);
_remotePacketSize = (uint) random.Next(0, int.MaxValue);
_channelClosedRegister = new List<ChannelEventArgs>();
_channelExceptionRegister = new List<ExceptionEventArgs>();
_initialSessionSemaphoreCount = random.Next(10, 20);
_sessionSemaphore = new SemaphoreLight(_initialSessionSemaphoreCount);
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
_connectionInfoMock = new Mock<IConnectionInfo>(MockBehavior.Strict);
protected override void SetupMocks()
{
_sequence = new MockSequence();
_sessionMock.InSequence(_sequence).Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object);
_connectionInfoMock.InSequence(_sequence).Setup(p => p.RetryAttempts).Returns(1);
_sessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
_sessionMock.InSequence(_sequence)
.Setup(
p =>
p.SendMessage(
It.Is<ChannelOpenMessage>(
m =>
m.LocalChannelNumber == _localChannelNumber &&
m.InitialWindowSize == _localWindowSize && m.MaximumPacketSize == _localPacketSize &&
m.Info is SessionChannelOpenInfo)));
_sessionMock.InSequence(_sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
_sessionMock.Raise(
s => s.ChannelOpenConfirmationReceived += null,
new MessageEventArgs<ChannelOpenConfirmationMessage>(
new ChannelOpenConfirmationMessage(
_localChannelNumber,
_remoteWindowSize,
_remotePacketSize,
_remoteChannelNumber)));
w.WaitOne();
});
_sessionMock.Setup(p => p.IsConnected).Returns(false);
SessionMock.InSequence(_sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(_sequence).Setup(p => p.RetryAttempts).Returns(1);
SessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
SessionMock.InSequence(_sequence)
.Setup(
p =>
p.SendMessage(
It.Is<ChannelOpenMessage>(
m =>
m.LocalChannelNumber == _localChannelNumber &&
m.InitialWindowSize == _localWindowSize && m.MaximumPacketSize == _localPacketSize &&
m.Info is SessionChannelOpenInfo)));
SessionMock.InSequence(_sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
SessionMock.Raise(
s => s.ChannelOpenConfirmationReceived += null,
new MessageEventArgs<ChannelOpenConfirmationMessage>(
new ChannelOpenConfirmationMessage(
_localChannelNumber,
_remoteWindowSize,
_remotePacketSize,
_remoteChannelNumber)));
w.WaitOne();
});
SessionMock.Setup(p => p.IsConnected).Returns(false);
}
_channel = new ChannelSession(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelSession(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) => _channelClosedRegister.Add(args);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.Open();
}
private void Act()
protected override void Act()
{
_channel.Dispose();
}
@@ -116,4 +113,4 @@ namespace Renci.SshNet.Tests.Classes.Channels
Assert.IsFalse(_channel.IsOpen);
}
}
}
}
@@ -11,52 +11,47 @@ using Renci.SshNet.Tests.Common;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelSessionTest_OnSessionChannelCloseReceived_SessionIsConnectedAndChannelIsOpen
public class ChannelSessionTest_OnSessionChannelCloseReceived_SessionIsConnectedAndChannelIsOpen : ChannelSessionTestBase
{
private Mock<ISession> _sessionMock;
private uint _localChannelNumber;
private uint _localWindowSize;
private uint _localPacketSize;
private uint _remoteChannelNumber;
private uint _remoteWindowSize;
private uint _remotePacketSize;
private TimeSpan _channelCloseTimeout;
private IList<ChannelEventArgs> _channelClosedRegister;
private List<ExceptionEventArgs> _channelExceptionRegister;
private ChannelSession _channel;
private Mock<IConnectionInfo> _connectionInfoMock;
private MockSequence _sequence;
private SemaphoreLight _sessionSemaphore;
private int _initialSessionSemaphoreCount;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(0, int.MaxValue);
_localPacketSize = (uint) random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint) random.Next(0, int.MaxValue);
_remoteWindowSize = (uint) random.Next(0, int.MaxValue);
_remotePacketSize = (uint) random.Next(0, int.MaxValue);
_channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20));
_channelClosedRegister = new List<ChannelEventArgs>();
_channelExceptionRegister = new List<ExceptionEventArgs>();
_initialSessionSemaphoreCount = random.Next(10, 20);
_sessionSemaphore = new SemaphoreLight(_initialSessionSemaphoreCount);
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
_connectionInfoMock = new Mock<IConnectionInfo>(MockBehavior.Strict);
protected override void SetupMocks()
{
_sequence = new MockSequence();
_sessionMock.InSequence(_sequence).Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object);
_connectionInfoMock.InSequence(_sequence).Setup(p => p.RetryAttempts).Returns(1);
_sessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
_sessionMock.InSequence(_sequence)
SessionMock.InSequence(_sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(_sequence).Setup(p => p.RetryAttempts).Returns(1);
SessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
SessionMock.InSequence(_sequence)
.Setup(
p =>
p.SendMessage(
@@ -65,12 +60,12 @@ namespace Renci.SshNet.Tests.Classes.Channels
m.LocalChannelNumber == _localChannelNumber &&
m.InitialWindowSize == _localWindowSize && m.MaximumPacketSize == _localPacketSize &&
m.Info is SessionChannelOpenInfo)));
_sessionMock.InSequence(_sequence)
SessionMock.InSequence(_sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
_sessionMock.Raise(
SessionMock.Raise(
s => s.ChannelOpenConfirmationReceived += null,
new MessageEventArgs<ChannelOpenConfirmationMessage>(
new ChannelOpenConfirmationMessage(
@@ -80,24 +75,32 @@ namespace Renci.SshNet.Tests.Classes.Channels
_remoteChannelNumber)));
w.WaitOne();
});
_sessionMock.InSequence(_sequence).Setup(p => p.IsConnected).Returns(true);
_sessionMock.InSequence(_sequence)
SessionMock.InSequence(_sequence).Setup(p => p.IsConnected).Returns(true);
SessionMock.InSequence(_sequence)
.Setup(
p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber)))
.Returns(true);
_sessionMock.InSequence(_sequence)
.Setup(s => s.WaitOnHandle(It.IsNotNull<EventWaitHandle>()))
.Callback<WaitHandle>(w => w.WaitOne());
SessionMock.InSequence(_sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(_sequence).Setup(p => p.ChannelCloseTimeout).Returns(_channelCloseTimeout);
SessionMock.InSequence(_sequence)
.Setup(p => p.TryWait(It.IsNotNull<WaitHandle>(), _channelCloseTimeout))
.Callback<WaitHandle, TimeSpan>((waitHandle, channelCloseTimeout) => waitHandle.WaitOne())
.Returns(WaitResult.Success);
}
_channel = new ChannelSession(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelSession(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) => _channelClosedRegister.Add(args);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.Open();
}
private void Act()
protected override void Act()
{
_sessionMock.Raise(
SessionMock.Raise(
p => p.ChannelCloseReceived += null,
new MessageEventArgs<ChannelCloseMessage>(new ChannelCloseMessage(_localChannelNumber)));
}
@@ -10,10 +10,8 @@ using Renci.SshNet.Messages.Connection;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelSessionTest_Open_ExceptionWaitingOnOpenConfirmation
public class ChannelSessionTest_Open_ExceptionWaitingOnOpenConfirmation : ChannelSessionTestBase
{
private Mock<ISession> _sessionMock;
private Mock<IConnectionInfo> _connectionInfoMock;
private ChannelSession _channel;
private uint _localChannelNumber;
private uint _localWindowSize;
@@ -25,51 +23,51 @@ namespace Renci.SshNet.Tests.Classes.Channels
private Exception _waitOnConfirmationException;
private SystemException _actualException;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint)random.Next(0, int.MaxValue);
_localWindowSize = (uint)random.Next(2000, 3000);
_localPacketSize = (uint)random.Next(1000, 2000);
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(2000, 3000);
_localPacketSize = (uint) random.Next(1000, 2000);
_initialSessionSemaphoreCount = random.Next(10, 20);
_sessionSemaphore = new SemaphoreLight(_initialSessionSemaphoreCount);
_channelClosedRegister = new List<ChannelEventArgs>();
_channelExceptionRegister = new List<ExceptionEventArgs>();
_waitOnConfirmationException = new SystemException();
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
_connectionInfoMock = new Mock<IConnectionInfo>(MockBehavior.Strict);
protected override void SetupMocks()
{
var sequence = new MockSequence();
_sessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object);
_connectionInfoMock.InSequence(sequence).Setup(p => p.RetryAttempts).Returns(2);
_sessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
_sessionMock.InSequence(sequence)
.Setup(
p =>
p.SendMessage(
It.Is<ChannelOpenMessage>(
m =>
m.LocalChannelNumber == _localChannelNumber &&
m.InitialWindowSize == _localWindowSize && m.MaximumPacketSize == _localPacketSize &&
m.Info is SessionChannelOpenInfo)));
_sessionMock.InSequence(sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Throws(_waitOnConfirmationException);
_channel = new ChannelSession(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
SessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(sequence).Setup(p => p.RetryAttempts).Returns(2);
SessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
SessionMock.InSequence(sequence)
.Setup(
p =>
p.SendMessage(
It.Is<ChannelOpenMessage>(
m =>
m.LocalChannelNumber == _localChannelNumber &&
m.InitialWindowSize == _localWindowSize && m.MaximumPacketSize == _localPacketSize &&
m.Info is SessionChannelOpenInfo)));
SessionMock.InSequence(sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Throws(_waitOnConfirmationException);
}
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelSession(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) => _channelClosedRegister.Add(args);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
}
private void Act()
protected override void Act()
{
try
{
@@ -84,7 +82,8 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void OpenShouldHaveRethrownExceptionThrownByWaitOnHandle()
{
Assert.IsNotNull(_actualException);
Assert.AreSame(_waitOnConfirmationException, _actualException);
}
[TestMethod]
@@ -11,10 +11,8 @@ using Renci.SshNet.Messages.Connection;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelSessionTest_Open_OnOpenFailureReceived_NoRetriesAvailable
public class ChannelSessionTest_Open_OnOpenFailureReceived_NoRetriesAvailable : ChannelSessionTestBase
{
private Mock<ISession> _sessionMock;
private Mock<IConnectionInfo> _connectionInfoMock;
private ChannelSession _channel;
private uint _localChannelNumber;
private uint _localWindowSize;
@@ -28,16 +26,10 @@ namespace Renci.SshNet.Tests.Classes.Channels
private string _failureLanguage;
private SshException _actualException;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(2000, 3000);
_localPacketSize = (uint) random.Next(1000, 2000);
@@ -50,15 +42,16 @@ namespace Renci.SshNet.Tests.Classes.Channels
_failureReasonCode = (uint)random.Next(0, int.MaxValue);
_failureDescription = random.Next().ToString(CultureInfo.InvariantCulture);
_failureLanguage = random.Next().ToString(CultureInfo.InvariantCulture);
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
_connectionInfoMock = new Mock<IConnectionInfo>(MockBehavior.Strict);
protected override void SetupMocks()
{
var sequence = new MockSequence();
_sessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object);
_connectionInfoMock.InSequence(sequence).Setup(p => p.RetryAttempts).Returns(1);
_sessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
_sessionMock.InSequence(sequence)
SessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(sequence).Setup(p => p.RetryAttempts).Returns(1);
SessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
SessionMock.InSequence(sequence)
.Setup(
p =>
p.SendMessage(
@@ -67,12 +60,12 @@ namespace Renci.SshNet.Tests.Classes.Channels
m.LocalChannelNumber == _localChannelNumber &&
m.InitialWindowSize == _localWindowSize && m.MaximumPacketSize == _localPacketSize &&
m.Info is SessionChannelOpenInfo)));
_sessionMock.InSequence(sequence)
SessionMock.InSequence(sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
_sessionMock.Raise(
SessionMock.Raise(
s => s.ChannelOpenFailureReceived += null,
new MessageEventArgs<ChannelOpenFailureMessage>(
new ChannelOpenFailureMessage(
@@ -83,15 +76,20 @@ namespace Renci.SshNet.Tests.Classes.Channels
)));
w.WaitOne();
});
_sessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object);
_connectionInfoMock.InSequence(sequence).Setup(p => p.RetryAttempts).Returns(1);
SessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(sequence).Setup(p => p.RetryAttempts).Returns(1);
}
_channel = new ChannelSession(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelSession(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) => _channelClosedRegister.Add(args);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
}
private void Act()
protected override void Act()
{
try
{
@@ -11,10 +11,8 @@ using Renci.SshNet.Messages.Connection;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelSessionTest_Open_OnOpenFailureReceived_RetriesAvalable
public class ChannelSessionTest_Open_OnOpenFailureReceived_RetriesAvalable : ChannelSessionTestBase
{
private Mock<ISession> _sessionMock;
private Mock<IConnectionInfo> _connectionInfoMock;
private ChannelSession _channel;
private uint _localChannelNumber;
private uint _localWindowSize;
@@ -30,97 +28,97 @@ namespace Renci.SshNet.Tests.Classes.Channels
private string _failureDescription;
private string _failureLanguage;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint)random.Next(0, int.MaxValue);
_localWindowSize = (uint)random.Next(2000, 3000);
_localPacketSize = (uint)random.Next(1000, 2000);
_remoteChannelNumber = (uint)random.Next(0, int.MaxValue);
_remoteWindowSize = (uint)random.Next(0, int.MaxValue);
_remotePacketSize = (uint)random.Next(0, int.MaxValue);
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(2000, 3000);
_localPacketSize = (uint) random.Next(1000, 2000);
_remoteChannelNumber = (uint) random.Next(0, int.MaxValue);
_remoteWindowSize = (uint) random.Next(0, int.MaxValue);
_remotePacketSize = (uint) random.Next(0, int.MaxValue);
_initialSessionSemaphoreCount = random.Next(10, 20);
_sessionSemaphore = new SemaphoreLight(_initialSessionSemaphoreCount);
_channelClosedRegister = new List<ChannelEventArgs>();
_channelExceptionRegister = new List<ExceptionEventArgs>();
_failureReasonCode = (uint)random.Next(0, int.MaxValue);
_failureReasonCode = (uint) random.Next(0, int.MaxValue);
_failureDescription = random.Next().ToString(CultureInfo.InvariantCulture);
_failureLanguage = random.Next().ToString(CultureInfo.InvariantCulture);
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
_connectionInfoMock = new Mock<IConnectionInfo>(MockBehavior.Strict);
protected override void SetupMocks()
{
var sequence = new MockSequence();
_sessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object);
_connectionInfoMock.InSequence(sequence).Setup(p => p.RetryAttempts).Returns(2);
_sessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
_sessionMock.InSequence(sequence)
.Setup(
p =>
p.SendMessage(
It.Is<ChannelOpenMessage>(
m =>
m.LocalChannelNumber == _localChannelNumber &&
m.InitialWindowSize == _localWindowSize && m.MaximumPacketSize == _localPacketSize &&
m.Info is SessionChannelOpenInfo)));
_sessionMock.InSequence(sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
_sessionMock.Raise(
s => s.ChannelOpenFailureReceived += null,
new MessageEventArgs<ChannelOpenFailureMessage>(
new ChannelOpenFailureMessage(
_localChannelNumber,
_failureDescription,
_failureReasonCode,
_failureLanguage
)));
w.WaitOne();
});
_sessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object);
_connectionInfoMock.InSequence(sequence).Setup(p => p.RetryAttempts).Returns(2);
_sessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
_sessionMock.InSequence(sequence)
.Setup(
p =>
p.SendMessage(
It.Is<ChannelOpenMessage>(
m =>
m.LocalChannelNumber == _localChannelNumber &&
m.InitialWindowSize == _localWindowSize && m.MaximumPacketSize == _localPacketSize &&
m.Info is SessionChannelOpenInfo)));
_sessionMock.InSequence(sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
_sessionMock.Raise(
s => s.ChannelOpenConfirmationReceived += null,
new MessageEventArgs<ChannelOpenConfirmationMessage>(
new ChannelOpenConfirmationMessage(
_localChannelNumber,
_remoteWindowSize,
_remotePacketSize,
_remoteChannelNumber)));
w.WaitOne();
});
_channel = new ChannelSession(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
SessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(sequence).Setup(p => p.RetryAttempts).Returns(2);
SessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
SessionMock.InSequence(sequence)
.Setup(
p =>
p.SendMessage(
It.Is<ChannelOpenMessage>(
m =>
m.LocalChannelNumber == _localChannelNumber &&
m.InitialWindowSize == _localWindowSize && m.MaximumPacketSize == _localPacketSize &&
m.Info is SessionChannelOpenInfo)));
SessionMock.InSequence(sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
SessionMock.Raise(
s => s.ChannelOpenFailureReceived += null,
new MessageEventArgs<ChannelOpenFailureMessage>(
new ChannelOpenFailureMessage(
_localChannelNumber,
_failureDescription,
_failureReasonCode,
_failureLanguage
)));
w.WaitOne();
});
SessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(sequence).Setup(p => p.RetryAttempts).Returns(2);
SessionMock.Setup(p => p.SessionSemaphore).Returns(_sessionSemaphore);
SessionMock.InSequence(sequence)
.Setup(
p =>
p.SendMessage(
It.Is<ChannelOpenMessage>(
m =>
m.LocalChannelNumber == _localChannelNumber &&
m.InitialWindowSize == _localWindowSize && m.MaximumPacketSize == _localPacketSize &&
m.Info is SessionChannelOpenInfo)));
SessionMock.InSequence(sequence)
.Setup(p => p.WaitOnHandle(It.IsNotNull<WaitHandle>()))
.Callback<WaitHandle>(
w =>
{
SessionMock.Raise(
s => s.ChannelOpenConfirmationReceived += null,
new MessageEventArgs<ChannelOpenConfirmationMessage>(
new ChannelOpenConfirmationMessage(
_localChannelNumber,
_remoteWindowSize,
_remotePacketSize,
_remoteChannelNumber)));
w.WaitOne();
});
}
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelSession(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) => _channelClosedRegister.Add(args);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
}
private void Act()
protected override void Act()
{
_channel.Open();
}
@@ -0,0 +1,37 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
namespace Renci.SshNet.Tests.Classes.Channels
{
public abstract class ChannelTestBase
{
internal Mock<ISession> SessionMock { get; private set; }
internal Mock<IConnectionInfo> ConnectionInfoMock { get; private set; }
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
protected abstract void SetupData();
protected void CreateMocks()
{
SessionMock = new Mock<ISession>(MockBehavior.Strict);
ConnectionInfoMock = new Mock<IConnectionInfo>(MockBehavior.Strict);
}
protected abstract void SetupMocks();
protected virtual void Arrange()
{
SetupData();
CreateMocks();
SetupMocks();
}
protected abstract void Act();
}
}
@@ -9,9 +9,8 @@ using Renci.SshNet.Messages;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelTest_Dispose_SessionIsConnectedAndChannelIsNotOpen
public class ChannelTest_Dispose_SessionIsConnectedAndChannelIsNotOpen : ChannelTestBase
{
private Mock<ISession> _sessionMock;
private uint _localWindowSize;
private uint _localPacketSize;
private uint _localChannelNumber;
@@ -19,32 +18,32 @@ namespace Renci.SshNet.Tests.Classes.Channels
private List<ChannelEventArgs> _channelClosedRegister;
private IList<ExceptionEventArgs> _channelExceptionRegister;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint)random.Next(0, int.MaxValue);
_localWindowSize = (uint)random.Next(0, int.MaxValue);
_localPacketSize = (uint)random.Next(0, int.MaxValue);
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(0, int.MaxValue);
_localPacketSize = (uint) random.Next(0, int.MaxValue);
_channelClosedRegister = new List<ChannelEventArgs>();
_channelExceptionRegister = new List<ExceptionEventArgs>();
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
protected override void SetupMocks()
{
SessionMock.Setup(p => p.IsConnected).Returns(true);
}
_sessionMock.Setup(p => p.IsConnected).Returns(true);
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelStub(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel = new ChannelStub(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) => _channelClosedRegister.Add(args);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
}
private void Act()
protected override void Act()
{
_channel.Dispose();
}
@@ -58,7 +57,7 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void SendMessageOnSessionShouldNeverBeInvoked()
{
_sessionMock.Verify(p => p.SendMessage(It.IsAny<Message>()), Times.Never);
SessionMock.Verify(p => p.SendMessage(It.IsAny<Message>()), Times.Never);
}
[TestMethod]
@@ -73,4 +72,4 @@ namespace Renci.SshNet.Tests.Classes.Channels
Assert.AreEqual(0, _channelExceptionRegister.Count);
}
}
}
}
@@ -10,84 +10,91 @@ using Renci.SshNet.Messages.Connection;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelTest_Dispose_SessionIsConnectedAndChannelIsOpen_EofNotReceived
public class ChannelTest_Dispose_SessionIsConnectedAndChannelIsOpen_EofNotReceived : ChannelTestBase
{
private Mock<ISession> _sessionMock;
private uint _localChannelNumber;
private uint _localWindowSize;
private uint _localPacketSize;
private uint _remoteChannelNumber;
private uint _remoteWindowSize;
private uint _remotePacketSize;
private TimeSpan _channelCloseTimeout;
private ChannelStub _channel;
private Stopwatch _closeTimer;
private ManualResetEvent _channelClosedWaitHandle;
private ManualResetEvent _channelClosedEventHandlerCompleted;
private List<ChannelEventArgs> _channelClosedRegister;
private IList<ExceptionEventArgs> _channelExceptionRegister;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint)random.Next(0, int.MaxValue);
_localWindowSize = (uint)random.Next(0, int.MaxValue);
_localPacketSize = (uint)random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint)random.Next(0, int.MaxValue);
_remoteWindowSize = (uint)random.Next(0, int.MaxValue);
_remotePacketSize = (uint)random.Next(0, int.MaxValue);
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(0, int.MaxValue);
_localPacketSize = (uint) random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint) random.Next(0, int.MaxValue);
_remoteWindowSize = (uint) random.Next(0, int.MaxValue);
_remotePacketSize = (uint) random.Next(0, int.MaxValue);
_channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20));
_closeTimer = new Stopwatch();
_channelClosedRegister = new List<ChannelEventArgs>();
_channelClosedWaitHandle = new ManualResetEvent(false);
_channelClosedEventHandlerCompleted = new ManualResetEvent(false);
_channelExceptionRegister = new List<ExceptionEventArgs>();
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
protected override void SetupMocks()
{
var sequence = new MockSequence();
_sessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
_sessionMock.InSequence(sequence).Setup(p => p.TrySendMessage(It.Is<ChannelEofMessage>(c => c.LocalChannelNumber == _remoteChannelNumber))).Returns(true);
_sessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
_sessionMock.InSequence(sequence).Setup(p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber))).Returns(true);
_sessionMock.InSequence(sequence).Setup(p => p.WaitOnHandle(It.IsAny<EventWaitHandle>()))
.Callback<WaitHandle>(w =>
{
new Thread(() =>
{
Thread.Sleep(100);
// raise ChannelCloseReceived event to set waithandle for receiving
// SSH_MSG_CHANNEL_CLOSE message from server which is waited on after
// sending the SSH_MSG_CHANNEL_CLOSE message to the server
_sessionMock.Raise(s => s.ChannelCloseReceived += null,
new MessageEventArgs<ChannelCloseMessage>(new ChannelCloseMessage(_localChannelNumber)));
}).Start();
_closeTimer.Start();
try
{
w.WaitOne();
}
finally
{
_closeTimer.Stop();
}
});
_channel = new ChannelStub(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
SessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
SessionMock.InSequence(sequence).Setup(p => p.TrySendMessage(It.Is<ChannelEofMessage>(c => c.LocalChannelNumber == _remoteChannelNumber))).Returns(true);
SessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
SessionMock.InSequence(sequence).Setup(p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber))).Returns(true);
SessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(sequence).Setup(p => p.ChannelCloseTimeout).Returns(_channelCloseTimeout);
SessionMock.InSequence(sequence)
.Setup(p => p.TryWait(It.IsAny<EventWaitHandle>(), _channelCloseTimeout))
.Callback<WaitHandle, TimeSpan>((waitHandle, channelCloseTimeout) =>
{
new Thread(() =>
{
Thread.Sleep(100);
// raise ChannelCloseReceived event to set waithandle for receiving
// SSH_MSG_CHANNEL_CLOSE message from server which is waited on after
// sending the SSH_MSG_CHANNEL_CLOSE message to the server
SessionMock.Raise(s => s.ChannelCloseReceived += null,
new MessageEventArgs<ChannelCloseMessage>(new ChannelCloseMessage(_localChannelNumber)));
}).Start();
_closeTimer.Start();
try
{
waitHandle.WaitOne();
}
finally
{
_closeTimer.Stop();
}
})
.Returns(WaitResult.Success);
}
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelStub(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) =>
{
_channelClosedRegister.Add(args);
_channelClosedWaitHandle.Set();
};
{
_channelClosedRegister.Add(args);
Thread.Sleep(50);
_channelClosedEventHandlerCompleted.Set();
};
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.InitializeRemoteChannelInfo(_remoteChannelNumber, _remoteWindowSize, _remotePacketSize);
_channel.SetIsOpen(true);
}
private void Act()
protected override void Act()
{
_channel.Dispose();
}
@@ -101,7 +108,7 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void TrySendMessageOnSessionShouldBeInvokedOnceForChannelCloseMessage()
{
_sessionMock.Verify(
SessionMock.Verify(
p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber)),
Times.Once);
}
@@ -109,15 +116,15 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void TrySendMessageOnSessionShouldBeInvokedOnceForChannelEofMessage()
{
_sessionMock.Verify(
SessionMock.Verify(
p => p.TrySendMessage(It.Is<ChannelEofMessage>(c => c.LocalChannelNumber == _remoteChannelNumber)),
Times.Once);
}
[TestMethod]
public void WaitOnHandleOnSessionShouldBeInvokedOnce()
public void TryWaitOnSessionShouldBeInvokedOnce()
{
_sessionMock.Verify(p => p.WaitOnHandle(It.IsAny<EventWaitHandle>()), Times.Once);
SessionMock.Verify(p => p.TryWait(It.IsAny<EventWaitHandle>(), _channelCloseTimeout), Times.Once);
}
[TestMethod]
@@ -129,16 +136,20 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ClosedEventShouldHaveFiredOnce()
{
_channelClosedWaitHandle.WaitOne(100);
Assert.AreEqual(1, _channelClosedRegister.Count);
Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber);
}
[TestMethod]
public void DisposeShouldBlockUntilClosedEventHandlerHasCompleted()
{
Assert.IsTrue(_channelClosedEventHandlerCompleted.WaitOne(0));
}
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count);
}
}
}
}
@@ -10,9 +10,9 @@ using Renci.SshNet.Messages.Connection;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelTest_Dispose_SessionIsConnectedAndChannelIsOpen_EofNotReceived_SendEofInvoked
[Ignore]
public class ChannelTest_Dispose_SessionIsConnectedAndChannelIsOpen_EofNotReceived_SendEofInvoked : ChannelTestBase
{
private Mock<ISession> _sessionMock;
private uint _localChannelNumber;
private uint _localWindowSize;
private uint _localPacketSize;
@@ -21,74 +21,86 @@ namespace Renci.SshNet.Tests.Classes.Channels
private uint _remotePacketSize;
private ChannelStub _channel;
private Stopwatch _closeTimer;
private ManualResetEvent _channelClosedWaitHandle;
private ManualResetEvent _channelClosedEventHandlerCompleted;
private List<ChannelEventArgs> _channelClosedRegister;
private IList<ExceptionEventArgs> _channelExceptionRegister;
[TestInitialize]
public void Initialize()
[TestCleanup]
public void TearDown()
{
Arrange();
Act();
if (_channelClosedEventHandlerCompleted != null)
{
_channelClosedEventHandlerCompleted.Dispose();
_channelClosedEventHandlerCompleted = null;
}
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint)random.Next(0, int.MaxValue);
_localWindowSize = (uint)random.Next(0, int.MaxValue);
_localPacketSize = (uint)random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint)random.Next(0, int.MaxValue);
_remoteWindowSize = (uint)random.Next(0, int.MaxValue);
_remotePacketSize = (uint)random.Next(0, int.MaxValue);
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(0, int.MaxValue);
_localPacketSize = (uint) random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint) random.Next(0, int.MaxValue);
_remoteWindowSize = (uint) random.Next(0, int.MaxValue);
_remotePacketSize = (uint) random.Next(0, int.MaxValue);
_closeTimer = new Stopwatch();
_channelClosedWaitHandle = new ManualResetEvent(false);
_channelClosedEventHandlerCompleted = new ManualResetEvent(false);
_channelClosedRegister = new List<ChannelEventArgs>();
_channelExceptionRegister = new List<ExceptionEventArgs>();
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
protected override void SetupMocks()
{
var sequence = new MockSequence();
_sessionMock.InSequence(sequence).Setup(p => p.SendMessage(It.Is<ChannelEofMessage>(c => c.LocalChannelNumber == _remoteChannelNumber)));
_sessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
_sessionMock.InSequence(sequence).Setup(p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber))).Returns(true);
_sessionMock.InSequence(sequence).Setup(p => p.WaitOnHandle(It.IsAny<EventWaitHandle>()))
.Callback<WaitHandle>(w =>
{
new Thread(() =>
{
Thread.Sleep(100);
// raise ChannelCloseReceived event to set waithandle for receiving
// SSH_MSG_CHANNEL_CLOSE message from server which is waited on after
// sending the SSH_MSG_CHANNEL_CLOSE message to the server
_sessionMock.Raise(s => s.ChannelCloseReceived += null,
new MessageEventArgs<ChannelCloseMessage>(
new ChannelCloseMessage(_localChannelNumber)));
}).Start();
_closeTimer.Start();
try
{
w.WaitOne();
}
finally
{
_closeTimer.Stop();
}
});
_channel = new ChannelStub(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
SessionMock.InSequence(sequence).Setup(p => p.SendMessage(It.Is<ChannelEofMessage>(c => c.LocalChannelNumber == _remoteChannelNumber)));
SessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
SessionMock.InSequence(sequence).Setup(p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber))).Returns(true);
SessionMock.InSequence(sequence).Setup(p => p.WaitOnHandle(It.IsAny<EventWaitHandle>()))
.Callback<WaitHandle>(w =>
{
new Thread(() =>
{
Thread.Sleep(100);
// raise ChannelCloseReceived event to set waithandle for receiving
// SSH_MSG_CHANNEL_CLOSE message from server which is waited on after
// sending the SSH_MSG_CHANNEL_CLOSE message to the server
SessionMock.Raise(s => s.ChannelCloseReceived += null,
new MessageEventArgs<ChannelCloseMessage>(
new ChannelCloseMessage(_localChannelNumber)));
}).Start();
_closeTimer.Start();
try
{
w.WaitOne();
}
finally
{
_closeTimer.Stop();
}
});
}
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelStub(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) =>
{
_channelClosedRegister.Add(args);
_channelClosedWaitHandle.Set();
};
{
_channelClosedRegister.Add(args);
Thread.Sleep(50);
_channelClosedEventHandlerCompleted.Set();
};
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.InitializeRemoteChannelInfo(_remoteChannelNumber, _remoteWindowSize, _remotePacketSize);
_channel.SetIsOpen(true);
_channel.SendEof();
//_channel.SendEof();
}
private void Act()
protected override void Act()
{
_channel.Dispose();
}
@@ -102,7 +114,7 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void TrySendMessageOnSessionShouldBeInvokedOnceForChannelCloseMessage()
{
_sessionMock.Verify(
SessionMock.Verify(
p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber)),
Times.Once);
}
@@ -110,7 +122,7 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void SendMessageOnSessionShouldBeInvokedOnceForChannelEofMessage()
{
_sessionMock.Verify(
SessionMock.Verify(
p => p.SendMessage(It.Is<ChannelEofMessage>(c => c.LocalChannelNumber == _remoteChannelNumber)),
Times.Once);
}
@@ -118,7 +130,7 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void WaitOnHandleOnSessionShouldBeInvokedOnce()
{
_sessionMock.Verify(p => p.WaitOnHandle(It.IsAny<EventWaitHandle>()), Times.Once);
SessionMock.Verify(p => p.WaitOnHandle(It.IsAny<EventWaitHandle>()), Times.Once);
}
[TestMethod]
@@ -130,16 +142,20 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void ClosedEventShouldHaveFiredOnce()
{
_channelClosedWaitHandle.WaitOne(100);
Assert.AreEqual(1, _channelClosedRegister.Count);
Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber);
}
[TestMethod]
public void DisposeShouldBlockUntilClosedEventHandlerHasCompleted()
{
Assert.IsTrue(_channelClosedEventHandlerCompleted.WaitOne(0));
}
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count);
}
}
}
}
@@ -9,23 +9,24 @@ using Renci.SshNet.Messages.Connection;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelTest_Dispose_SessionIsConnectedAndChannelIsOpen_EofReceived
public class ChannelTest_Dispose_SessionIsConnectedAndChannelIsOpen_EofReceived : ChannelTestBase
{
private Mock<ISession> _sessionMock;
private uint _localChannelNumber;
private uint _localWindowSize;
private uint _localPacketSize;
private uint _remoteChannelNumber;
private uint _remoteWindowSize;
private uint _remotePacketSize;
private TimeSpan _channelCloseTimeout;
private ChannelStub _channel;
private List<ChannelEventArgs> _channelClosedRegister;
private List<ChannelEventArgs> _channelEndOfDataRegister;
private IList<ExceptionEventArgs> _channelExceptionRegister;
private ManualResetEvent _channelClosedReceived;
private ManualResetEvent _channelClosedEventHandlerCompleted;
private Thread _raiseChannelCloseReceivedThread;
private void SetupData()
protected override void SetupData()
{
var random = new Random();
@@ -35,59 +36,53 @@ namespace Renci.SshNet.Tests.Classes.Channels
_remoteChannelNumber = (uint) random.Next(0, int.MaxValue);
_remoteWindowSize = (uint) random.Next(0, int.MaxValue);
_remotePacketSize = (uint) random.Next(0, int.MaxValue);
_channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20));
_channelClosedRegister = new List<ChannelEventArgs>();
_channelEndOfDataRegister = new List<ChannelEventArgs>();
_channelExceptionRegister = new List<ExceptionEventArgs>();
_channelClosedReceived = new ManualResetEvent(false);
_channelClosedEventHandlerCompleted = new ManualResetEvent(false);
_raiseChannelCloseReceivedThread = null;
}
private void CreateMocks()
{
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
}
private void SetupMocks()
protected override void SetupMocks()
{
var sequence = new MockSequence();
_sessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
_sessionMock.InSequence(sequence).Setup(p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber))).Returns(true);
_sessionMock.InSequence(sequence).Setup(p => p.WaitOnHandle(It.IsAny<EventWaitHandle>()))
.Callback<WaitHandle>(w =>
{
_raiseChannelCloseReceivedThread = new Thread(() =>
{
Thread.Sleep(100);
SessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
SessionMock.InSequence(sequence).Setup(p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber))).Returns(true);
SessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(sequence).Setup(p => p.ChannelCloseTimeout).Returns(_channelCloseTimeout);
SessionMock.InSequence(sequence)
.Setup(p => p.TryWait(It.IsAny<EventWaitHandle>(), _channelCloseTimeout))
.Callback<WaitHandle, TimeSpan>((waitHandle, channelCloseTimeout) =>
{
_raiseChannelCloseReceivedThread = new Thread(() =>
{
Thread.Sleep(100);
// signal that the ChannelCloseMessage was received; we use this to verify whether we've actually
// waited on the EventWaitHandle to be set; this needs to be set before we raise the ChannelCloseReceived
// to make sure the waithandle is signaled when the Dispose method completes (or else the assert that
// checks whether the handle has been signaled, will sometimes fail)
_channelClosedReceived.Set();
// signal that the ChannelCloseMessage was received; we use this to verify whether we've actually
// waited on the EventWaitHandle to be set; this needs to be set before we raise the ChannelCloseReceived
// to make sure the waithandle is signaled when the Dispose method completes (or else the assert that
// checks whether the handle has been signaled, will sometimes fail)
_channelClosedReceived.Set();
// raise ChannelCloseReceived event to set waithandle for receiving SSH_MSG_CHANNEL_CLOSE message
// from server which is waited on after sending the SSH_MSG_CHANNEL_CLOSE message to the server
//
// this will cause a new invocation of Close() that will block until the Close() that was invoked
// as part of Dispose() has released the lock; as such, this thread cannot be joined until that
// lock is released
//
// we're mocking the wait on the ChannelCloseMessage, but we still want
// to get the channel in the state that it would have after actually receiving
// the ChannelCloseMessage
_sessionMock.Raise(s => s.ChannelCloseReceived += null, new MessageEventArgs<ChannelCloseMessage>(new ChannelCloseMessage(_localChannelNumber)));
});
_raiseChannelCloseReceivedThread.Start();
w.WaitOne();
});
}
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
// raise ChannelCloseReceived event to set waithandle for receiving SSH_MSG_CHANNEL_CLOSE message
// from server which is waited on after sending the SSH_MSG_CHANNEL_CLOSE message to the server
//
// this will cause a new invocation of Close() that will block until the Close() that was invoked
// as part of Dispose() has released the lock; as such, this thread cannot be joined until that
// lock is released
//
// we're mocking the wait on the ChannelCloseMessage, but we still want
// to get the channel in the state that it would have after actually receiving
// the ChannelCloseMessage
SessionMock.Raise(s => s.ChannelCloseReceived += null, new MessageEventArgs<ChannelCloseMessage>(new ChannelCloseMessage(_localChannelNumber)));
});
_raiseChannelCloseReceivedThread.Start();
waitHandle.WaitOne();
})
.Returns(WaitResult.Success);
}
[TestCleanup]
@@ -106,27 +101,36 @@ namespace Renci.SshNet.Tests.Classes.Channels
_raiseChannelCloseReceivedThread.Abort();
}
}
if (_channelClosedEventHandlerCompleted != null)
{
_channelClosedEventHandlerCompleted.Dispose();
_channelClosedEventHandlerCompleted = null;
}
}
private void Arrange()
protected override void Arrange()
{
SetupData();
CreateMocks();
SetupMocks();
base.Arrange();
_channel = new ChannelStub(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) => _channelClosedRegister.Add(args);
_channel = new ChannelStub(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) =>
{
_channelClosedRegister.Add(args);
Thread.Sleep(50);
_channelClosedEventHandlerCompleted.Set();
};
_channel.EndOfData += (sender, args) => _channelEndOfDataRegister.Add(args);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.InitializeRemoteChannelInfo(_remoteChannelNumber, _remoteWindowSize, _remotePacketSize);
_channel.SetIsOpen(true);
_sessionMock.Raise(
SessionMock.Raise(
s => s.ChannelEofReceived += null,
new MessageEventArgs<ChannelEofMessage>(new ChannelEofMessage(_localChannelNumber)));
}
private void Act()
protected override void Act()
{
_channel.Dispose();
}
@@ -140,7 +144,7 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void TrySendMessageOnSessionShouldBeInvokedOnceForChannelCloseMessage()
{
_sessionMock.Verify(
SessionMock.Verify(
p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber)),
Times.Once);
}
@@ -148,15 +152,15 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void TrySendMessageOnSessionShouldNeverBeInvokedForChannelEofMessage()
{
_sessionMock.Verify(
SessionMock.Verify(
p => p.TrySendMessage(It.Is<ChannelEofMessage>(c => c.LocalChannelNumber == _remoteChannelNumber)),
Times.Never);
}
[TestMethod]
public void WaitOnHandleOnSessionShouldBeInvokedOnce()
public void TryWaitOnSessionShouldBeInvokedOnce()
{
_sessionMock.Verify(p => p.WaitOnHandle(It.IsAny<EventWaitHandle>()), Times.Once);
SessionMock.Verify(p => p.TryWait(It.IsAny<EventWaitHandle>(), _channelCloseTimeout), Times.Once);
}
[TestMethod]
@@ -173,7 +177,7 @@ namespace Renci.SshNet.Tests.Classes.Channels
}
[TestMethod]
public void EndOfDataEventShouldHaveFiredOnce()
public void EndOfDataEventShouldNotHaveFired()
{
Assert.AreEqual(1, _channelEndOfDataRegister.Count);
Assert.AreEqual(_localChannelNumber, _channelEndOfDataRegister[0].ChannelNumber);
@@ -0,0 +1,121 @@
using System;
using System.Collections.Generic;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Renci.SshNet.Common;
using Renci.SshNet.Messages.Connection;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelTest_Dispose_SessionIsConnectedAndChannelIsOpen_EofReceived_DisconnectWaitingForChannelCloseMessage : ChannelTestBase
{
private uint _localChannelNumber;
private uint _localWindowSize;
private uint _localPacketSize;
private uint _remoteChannelNumber;
private uint _remoteWindowSize;
private uint _remotePacketSize;
private TimeSpan _channelCloseTimeout;
private ChannelStub _channel;
private List<ChannelEventArgs> _channelClosedRegister;
private List<ChannelEventArgs> _channelEndOfDataRegister;
private IList<ExceptionEventArgs> _channelExceptionRegister;
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(0, int.MaxValue);
_localPacketSize = (uint) random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint) random.Next(0, int.MaxValue);
_remoteWindowSize = (uint) random.Next(0, int.MaxValue);
_remotePacketSize = (uint) random.Next(0, int.MaxValue);
_channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20));
_channelClosedRegister = new List<ChannelEventArgs>();
_channelEndOfDataRegister = new List<ChannelEventArgs>();
_channelExceptionRegister = new List<ExceptionEventArgs>();
}
protected override void SetupMocks()
{
var sequence = new MockSequence();
SessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
SessionMock.InSequence(sequence).Setup(p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber))).Returns(true);
SessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(sequence).Setup(p => p.ChannelCloseTimeout).Returns(_channelCloseTimeout);
SessionMock.InSequence(sequence).Setup(p => p.TryWait(It.IsAny<EventWaitHandle>(), _channelCloseTimeout)).Returns(WaitResult.Disconnected);
}
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelStub(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) => { _channelClosedRegister.Add(args); };
_channel.EndOfData += (sender, args) => _channelEndOfDataRegister.Add(args);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.InitializeRemoteChannelInfo(_remoteChannelNumber, _remoteWindowSize, _remotePacketSize);
_channel.SetIsOpen(true);
SessionMock.Raise(
s => s.ChannelEofReceived += null,
new MessageEventArgs<ChannelEofMessage>(new ChannelEofMessage(_localChannelNumber)));
}
protected override void Act()
{
_channel.Dispose();
}
[TestMethod]
public void IsOpenShouldReturnFalse()
{
Assert.IsFalse(_channel.IsOpen);
}
[TestMethod]
public void TrySendMessageOnSessionShouldBeInvokedOnceForChannelCloseMessage()
{
SessionMock.Verify(
p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber)),
Times.Once);
}
[TestMethod]
public void TrySendMessageOnSessionShouldNeverBeInvokedForChannelEofMessage()
{
SessionMock.Verify(
p => p.TrySendMessage(It.Is<ChannelEofMessage>(c => c.LocalChannelNumber == _remoteChannelNumber)),
Times.Never);
}
[TestMethod]
public void TryWaitOnSessionShouldBeInvokedOnce()
{
SessionMock.Verify(p => p.TryWait(It.IsAny<EventWaitHandle>(), _channelCloseTimeout), Times.Once);
}
[TestMethod]
public void ClosedEventShouldNotHaveFired()
{
Assert.AreEqual(0, _channelClosedRegister.Count);
}
[TestMethod]
public void EndOfDataEventShouldNotHaveFired()
{
Assert.AreEqual(1, _channelEndOfDataRegister.Count);
Assert.AreEqual(_localChannelNumber, _channelEndOfDataRegister[0].ChannelNumber);
}
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count);
}
}
}
@@ -0,0 +1,121 @@
using System;
using System.Collections.Generic;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Renci.SshNet.Common;
using Renci.SshNet.Messages.Connection;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelTest_Dispose_SessionIsConnectedAndChannelIsOpen_EofReceived_TimeoutWaitingForChannelCloseMessage : ChannelTestBase
{
private uint _localChannelNumber;
private uint _localWindowSize;
private uint _localPacketSize;
private uint _remoteChannelNumber;
private uint _remoteWindowSize;
private uint _remotePacketSize;
private TimeSpan _channelCloseTimeout;
private ChannelStub _channel;
private List<ChannelEventArgs> _channelClosedRegister;
private List<ChannelEventArgs> _channelEndOfDataRegister;
private IList<ExceptionEventArgs> _channelExceptionRegister;
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(0, int.MaxValue);
_localPacketSize = (uint) random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint) random.Next(0, int.MaxValue);
_remoteWindowSize = (uint) random.Next(0, int.MaxValue);
_remotePacketSize = (uint) random.Next(0, int.MaxValue);
_channelCloseTimeout = TimeSpan.FromSeconds(random.Next());
_channelClosedRegister = new List<ChannelEventArgs>();
_channelEndOfDataRegister = new List<ChannelEventArgs>();
_channelExceptionRegister = new List<ExceptionEventArgs>();
}
protected override void SetupMocks()
{
var sequence = new MockSequence();
SessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
SessionMock.InSequence(sequence).Setup(p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber))).Returns(true);
SessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(sequence).Setup(p => p.ChannelCloseTimeout).Returns(_channelCloseTimeout);
SessionMock.InSequence(sequence).Setup(p => p.TryWait(It.IsAny<EventWaitHandle>(), _channelCloseTimeout)).Returns(WaitResult.TimedOut);
}
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelStub(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) => { _channelClosedRegister.Add(args); };
_channel.EndOfData += (sender, args) => _channelEndOfDataRegister.Add(args);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.InitializeRemoteChannelInfo(_remoteChannelNumber, _remoteWindowSize, _remotePacketSize);
_channel.SetIsOpen(true);
SessionMock.Raise(
s => s.ChannelEofReceived += null,
new MessageEventArgs<ChannelEofMessage>(new ChannelEofMessage(_localChannelNumber)));
}
protected override void Act()
{
_channel.Dispose();
}
[TestMethod]
public void IsOpenShouldReturnFalse()
{
Assert.IsFalse(_channel.IsOpen);
}
[TestMethod]
public void TrySendMessageOnSessionShouldBeInvokedOnceForChannelCloseMessage()
{
SessionMock.Verify(
p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber)),
Times.Once);
}
[TestMethod]
public void TrySendMessageOnSessionShouldNeverBeInvokedForChannelEofMessage()
{
SessionMock.Verify(
p => p.TrySendMessage(It.Is<ChannelEofMessage>(c => c.LocalChannelNumber == _remoteChannelNumber)),
Times.Never);
}
[TestMethod]
public void TryWaitOnSessionShouldBeInvokedOnce()
{
SessionMock.Verify(p => p.TryWait(It.IsAny<EventWaitHandle>(), _channelCloseTimeout), Times.Once);
}
[TestMethod]
public void ClosedEventShouldNotHaveFired()
{
Assert.AreEqual(0, _channelClosedRegister.Count);
}
[TestMethod]
public void EndOfDataEventShouldNotHaveFired()
{
Assert.AreEqual(1, _channelEndOfDataRegister.Count);
Assert.AreEqual(_localChannelNumber, _channelEndOfDataRegister[0].ChannelNumber);
}
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count);
}
}
}
@@ -9,9 +9,8 @@ using Renci.SshNet.Messages;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelTest_Dispose_SessionIsNotConnectedAndChannelIsNotOpen
public class ChannelTest_Dispose_SessionIsNotConnectedAndChannelIsNotOpen : ChannelTestBase
{
private Mock<ISession> _sessionMock;
private uint _localWindowSize;
private uint _localPacketSize;
private uint _localChannelNumber;
@@ -19,32 +18,32 @@ namespace Renci.SshNet.Tests.Classes.Channels
private List<ChannelEventArgs> _channelClosedRegister;
private IList<ExceptionEventArgs> _channelExceptionRegister;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint)random.Next(0, int.MaxValue);
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(0, int.MaxValue);
_localPacketSize = (uint) random.Next(0, int.MaxValue);
_channelClosedRegister = new List<ChannelEventArgs>();
_channelExceptionRegister = new List<ExceptionEventArgs>();
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
protected override void SetupMocks()
{
SessionMock.Setup(p => p.IsConnected).Returns(false);
}
_sessionMock.Setup(p => p.IsConnected).Returns(false);
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelStub(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel = new ChannelStub(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) => _channelClosedRegister.Add(args);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
}
private void Act()
protected override void Act()
{
_channel.Dispose();
}
@@ -58,7 +57,7 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void SendMessageOnSessionShouldNeverBeInvoked()
{
_sessionMock.Verify(p => p.SendMessage(It.IsAny<Message>()), Times.Never);
SessionMock.Verify(p => p.SendMessage(It.IsAny<Message>()), Times.Never);
}
[TestMethod]
@@ -73,4 +72,4 @@ namespace Renci.SshNet.Tests.Classes.Channels
Assert.AreEqual(0, _channelExceptionRegister.Count);
}
}
}
}
@@ -8,9 +8,8 @@ using Renci.SshNet.Messages;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelTest_Dispose_SessionIsNotConnectedAndChannelIsOpen
public class ChannelTest_Dispose_SessionIsNotConnectedAndChannelIsOpen : ChannelTestBase
{
private Mock<ISession> _sessionMock;
private uint _localWindowSize;
private uint _localPacketSize;
private uint _localChannelNumber;
@@ -18,33 +17,33 @@ namespace Renci.SshNet.Tests.Classes.Channels
private List<ChannelEventArgs> _channelClosedRegister;
private IList<ExceptionEventArgs> _channelExceptionRegister;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint)random.Next(0, int.MaxValue);
_localWindowSize = (uint)random.Next(0, int.MaxValue);
_localPacketSize = (uint)random.Next(0, int.MaxValue);
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(0, int.MaxValue);
_localPacketSize = (uint) random.Next(0, int.MaxValue);
_channelClosedRegister = new List<ChannelEventArgs>();
_channelExceptionRegister = new List<ExceptionEventArgs>();
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
protected override void SetupMocks()
{
SessionMock.Setup(p => p.IsConnected).Returns(false);
}
_sessionMock.Setup(p => p.IsConnected).Returns(false);
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelStub(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel = new ChannelStub(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) => _channelClosedRegister.Add(args);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.SetIsOpen(true);
}
private void Act()
protected override void Act()
{
_channel.Dispose();
}
@@ -58,7 +57,7 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void SendMessageOnSessionShouldNeverBeInvoked()
{
_sessionMock.Verify(p => p.SendMessage(It.IsAny<Message>()), Times.Never);
SessionMock.Verify(p => p.SendMessage(It.IsAny<Message>()), Times.Never);
}
[TestMethod]
@@ -73,4 +72,4 @@ namespace Renci.SshNet.Tests.Classes.Channels
Assert.AreEqual(0, _channelExceptionRegister.Count);
}
}
}
}
@@ -8,9 +8,8 @@ using Renci.SshNet.Messages.Connection;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelTest_OnSessionChannelCloseReceived_OnClose_Exception
public class ChannelTest_OnSessionChannelCloseReceived_OnClose_Exception : ChannelTestBase
{
private Mock<ISession> _sessionMock;
private uint _localWindowSize;
private uint _localPacketSize;
private uint _localChannelNumber;
@@ -18,32 +17,33 @@ namespace Renci.SshNet.Tests.Classes.Channels
private IList<ExceptionEventArgs> _channelExceptionRegister;
private Exception _onCloseException;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localWindowSize = (uint) random.Next(1000, int.MaxValue);
_localPacketSize = _localWindowSize - 1;
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_onCloseException = new SystemException();
_channelExceptionRegister = new List<ExceptionEventArgs>();
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
protected override void SetupMocks()
{
}
_channel = new ChannelStub(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelStub(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.OnCloseException = _onCloseException;
}
private void Act()
protected override void Act()
{
_sessionMock.Raise(s => s.ChannelCloseReceived += null,
SessionMock.Raise(s => s.ChannelCloseReceived += null,
new MessageEventArgs<ChannelCloseMessage>(new ChannelCloseMessage(_localChannelNumber)));
}
@@ -0,0 +1,143 @@
using System;
using System.Collections.Generic;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Renci.SshNet.Common;
using Renci.SshNet.Messages.Connection;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelTest_OnSessionChannelCloseReceived_SessionIsConnectedAndChannelIsOpen_DisposeChannelInClosedEventHandler : ChannelTestBase
{
private uint _localChannelNumber;
private uint _localWindowSize;
private uint _localPacketSize;
private uint _remoteChannelNumber;
private uint _remoteWindowSize;
private uint _remotePacketSize;
private TimeSpan _channelCloseTimeout;
private ChannelStub _channel;
private List<ChannelEventArgs> _channelClosedRegister;
private List<ChannelEventArgs> _channelEndOfDataRegister;
private IList<ExceptionEventArgs> _channelExceptionRegister;
private ManualResetEvent _channelClosedEventHandlerCompleted;
private bool _channelClosedWaitHandleSignaled;
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(0, int.MaxValue);
_localPacketSize = (uint) random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint) random.Next(0, int.MaxValue);
_remoteWindowSize = (uint) random.Next(0, int.MaxValue);
_remotePacketSize = (uint) random.Next(0, int.MaxValue);
_channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20));
_channelClosedWaitHandleSignaled = false;
_channelClosedRegister = new List<ChannelEventArgs>();
_channelEndOfDataRegister = new List<ChannelEventArgs>();
_channelExceptionRegister = new List<ExceptionEventArgs>();
_channelClosedEventHandlerCompleted = new ManualResetEvent(false);
}
protected override void SetupMocks()
{
var sequence = new MockSequence();
SessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
SessionMock.InSequence(sequence).Setup(p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber))).Returns(true);
SessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(sequence).Setup(p => p.ChannelCloseTimeout).Returns(_channelCloseTimeout);
SessionMock.InSequence(sequence)
.Setup(p => p.TryWait(It.IsAny<EventWaitHandle>(), _channelCloseTimeout))
.Callback<WaitHandle, TimeSpan>((waitHandle, channelCloseTimeout) => _channelClosedWaitHandleSignaled = waitHandle.WaitOne(0))
.Returns(WaitResult.Success);
}
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelStub(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) =>
{
_channelClosedRegister.Add(args);
_channel.Dispose();
_channelClosedEventHandlerCompleted.Set();
};
_channel.EndOfData += (sender, args) => _channelEndOfDataRegister.Add(args);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.InitializeRemoteChannelInfo(_remoteChannelNumber, _remoteWindowSize, _remotePacketSize);
_channel.SetIsOpen(true);
}
protected override void Act()
{
SessionMock.Raise(
s => s.ChannelCloseReceived += null,
new MessageEventArgs<ChannelCloseMessage>(new ChannelCloseMessage(_localChannelNumber)));
}
[TestMethod]
public void IsOpenShouldReturnFalse()
{
Assert.IsFalse(_channel.IsOpen);
}
[TestMethod]
public void TrySendMessageOnSessionShouldBeInvokedOnceForChannelCloseMessage()
{
SessionMock.Verify(
p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber)),
Times.Once);
}
[TestMethod]
public void TrySendMessageOnSessionShouldNeverBeInvokedForChannelEofMessage()
{
SessionMock.Verify(
p => p.TrySendMessage(It.Is<ChannelEofMessage>(c => c.LocalChannelNumber == _remoteChannelNumber)),
Times.Never);
}
[TestMethod]
public void TryWaitOnSessionShouldBeInvokedOnce()
{
SessionMock.Verify(p => p.TryWait(It.IsAny<EventWaitHandle>(), _channelCloseTimeout), Times.Once);
}
[TestMethod]
public void ChannelCloseWaitHandleShouldHaveBeenSignaledImmediately()
{
Assert.IsTrue(_channelClosedWaitHandleSignaled);
}
[TestMethod]
public void ClosedEventShouldHaveFiredOnce()
{
Assert.AreEqual(1, _channelClosedRegister.Count);
Assert.AreEqual(_localChannelNumber, _channelClosedRegister[0].ChannelNumber);
}
[TestMethod]
public void EndOfDataEventShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelEndOfDataRegister.Count);
}
[TestMethod]
public void ExceptionShouldNeverHaveFired()
{
Assert.AreEqual(0, _channelExceptionRegister.Count);
}
[TestMethod]
public void ChannelCloseReceivedShouldBlockUntilClosedEventHandlerHasCompleted()
{
Assert.IsTrue(_channelClosedEventHandlerCompleted.WaitOne(0));
}
}
}
@@ -10,58 +10,69 @@ using Renci.SshNet.Tests.Common;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelTest_OnSessionChannelCloseReceived_SessionIsConnectedAndChannelIsOpen_EofNotReceived
public class ChannelTest_OnSessionChannelCloseReceived_SessionIsConnectedAndChannelIsOpen_EofNotReceived : ChannelTestBase
{
private Mock<ISession> _sessionMock;
private uint _localChannelNumber;
private uint _localWindowSize;
private uint _localPacketSize;
private uint _remoteChannelNumber;
private uint _remoteWindowSize;
private uint _remotePacketSize;
private TimeSpan _channelCloseTimeout;
private IList<ChannelEventArgs> _channelClosedRegister;
private IList<ExceptionEventArgs> _channelExceptionRegister;
private ManualResetEvent _channelClosedEventHandlerCompleted;
private ChannelStub _channel;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint)random.Next(0, int.MaxValue);
_localWindowSize = (uint)random.Next(0, int.MaxValue);
_localPacketSize = (uint)random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint)random.Next(0, int.MaxValue);
_remoteWindowSize = (uint)random.Next(0, int.MaxValue);
_remotePacketSize = (uint)random.Next(0, int.MaxValue);
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(0, int.MaxValue);
_localPacketSize = (uint) random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint) random.Next(0, int.MaxValue);
_remoteWindowSize = (uint) random.Next(0, int.MaxValue);
_remotePacketSize = (uint) random.Next(0, int.MaxValue);
_channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20));
_channelClosedRegister = new List<ChannelEventArgs>();
_channelExceptionRegister = new List<ExceptionEventArgs>();
_channelClosedEventHandlerCompleted = new ManualResetEvent(false);
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
protected override void SetupMocks()
{
var sequence = new MockSequence();
_sessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
_sessionMock.InSequence(sequence).Setup(p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber))).Returns(true);
_sessionMock.InSequence(sequence)
.Setup(s => s.WaitOnHandle(It.IsNotNull<EventWaitHandle>()))
.Callback<WaitHandle>(w => w.WaitOne());
SessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
SessionMock.InSequence(sequence).Setup(p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber))).Returns(true);
SessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(sequence).Setup(p => p.ChannelCloseTimeout).Returns(_channelCloseTimeout);
SessionMock.InSequence(sequence)
.Setup(p => p.TryWait(It.IsAny<EventWaitHandle>(), _channelCloseTimeout))
.Callback<WaitHandle, TimeSpan>((waitHandle, channelCloseTimeout) => waitHandle.WaitOne())
.Returns(WaitResult.Success);
}
_channel = new ChannelStub(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) => _channelClosedRegister.Add(args);
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelStub(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) =>
{
_channelClosedRegister.Add(args);
Thread.Sleep(100);
_channelClosedEventHandlerCompleted.Set();
};
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.InitializeRemoteChannelInfo(_remoteChannelNumber, _remoteWindowSize, _remotePacketSize);
_channel.SetIsOpen(true);
}
private void Act()
protected override void Act()
{
_sessionMock.Raise(p => p.ChannelCloseReceived += null,
SessionMock.Raise(p => p.ChannelCloseReceived += null,
new MessageEventArgs<ChannelCloseMessage>(new ChannelCloseMessage(_localChannelNumber)));
}
@@ -74,7 +85,7 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void TrySendMessageOnSessionShouldBeInvokedOnceForChannelCloseMessage()
{
_sessionMock.Verify(
SessionMock.Verify(
p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber)),
Times.Once);
}
@@ -82,15 +93,15 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void TrySendMessageOnSessionShouldNeverBeInvokedForChannelEofMessage()
{
_sessionMock.Verify(
SessionMock.Verify(
p => p.TrySendMessage(It.Is<ChannelEofMessage>(c => c.LocalChannelNumber == _remoteChannelNumber)),
Times.Never);
}
[TestMethod]
public void WaitOnHandleOnSessionShouldBeInvokedOnce()
public void TryWaitOnSessionShouldBeInvokedOnce()
{
_sessionMock.Verify(p => p.WaitOnHandle(It.IsAny<EventWaitHandle>()), Times.Once);
SessionMock.Verify(p => p.TryWait(It.IsAny<EventWaitHandle>(), _channelCloseTimeout), Times.Once);
}
[TestMethod]
@@ -105,5 +116,11 @@ namespace Renci.SshNet.Tests.Classes.Channels
{
Assert.AreEqual(0, _channelExceptionRegister.Count, _channelExceptionRegister.AsString());
}
[TestMethod]
public void ChannelCloseReceivedShouldBlockUntilClosedEventHandlerHasCompleted()
{
Assert.IsTrue(_channelClosedEventHandlerCompleted.WaitOne(0));
}
}
}
@@ -10,64 +10,73 @@ using Renci.SshNet.Tests.Common;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelTest_OnSessionChannelCloseReceived_SessionIsConnectedAndChannelIsOpen_EofReceived
public class ChannelTest_OnSessionChannelCloseReceived_SessionIsConnectedAndChannelIsOpen_EofReceived : ChannelTestBase
{
private Mock<ISession> _sessionMock;
private uint _localChannelNumber;
private uint _localWindowSize;
private uint _localPacketSize;
private uint _remoteChannelNumber;
private uint _remoteWindowSize;
private uint _remotePacketSize;
private TimeSpan _channelCloseTimeout;
private IList<ChannelEventArgs> _channelClosedRegister;
private IList<ExceptionEventArgs> _channelExceptionRegister;
private ManualResetEvent _channelClosedEventHandlerCompleted;
private ChannelStub _channel;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint)random.Next(0, int.MaxValue);
_localWindowSize = (uint)random.Next(0, int.MaxValue);
_localPacketSize = (uint)random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint)random.Next(0, int.MaxValue);
_remoteWindowSize = (uint)random.Next(0, int.MaxValue);
_remotePacketSize = (uint)random.Next(0, int.MaxValue);
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(0, int.MaxValue);
_localPacketSize = (uint) random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint) random.Next(0, int.MaxValue);
_remoteWindowSize = (uint) random.Next(0, int.MaxValue);
_remotePacketSize = (uint) random.Next(0, int.MaxValue);
_channelCloseTimeout = TimeSpan.FromSeconds(random.Next(10, 20));
_channelClosedRegister = new List<ChannelEventArgs>();
_channelExceptionRegister = new List<ExceptionEventArgs>();
_channelClosedEventHandlerCompleted = new ManualResetEvent(false);
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
protected override void SetupMocks()
{
var sequence = new MockSequence();
_sessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
_sessionMock.InSequence(sequence).Setup(
p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber)))
.Returns(true);
_sessionMock.InSequence(sequence)
.Setup(s => s.WaitOnHandle(It.IsNotNull<EventWaitHandle>()))
.Callback<WaitHandle>(w => w.WaitOne());
SessionMock.InSequence(sequence).Setup(p => p.IsConnected).Returns(true);
SessionMock.InSequence(sequence).Setup(p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber))).Returns(true);
SessionMock.InSequence(sequence).Setup(p => p.ConnectionInfo).Returns(ConnectionInfoMock.Object);
ConnectionInfoMock.InSequence(sequence).Setup(p => p.ChannelCloseTimeout).Returns(_channelCloseTimeout);
SessionMock.InSequence(sequence)
.Setup(p => p.TryWait(It.IsAny<EventWaitHandle>(), _channelCloseTimeout))
.Callback<WaitHandle, TimeSpan>((waitHandle, channelCloseTimeout) => waitHandle.WaitOne())
.Returns(WaitResult.Success);
}
_channel = new ChannelStub(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) => _channelClosedRegister.Add(args);
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelStub(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) =>
{
_channelClosedRegister.Add(args);
Thread.Sleep(100);
_channelClosedEventHandlerCompleted.Set();
};
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.InitializeRemoteChannelInfo(_remoteChannelNumber, _remoteWindowSize, _remotePacketSize);
_channel.SetIsOpen(true);
_sessionMock.Raise(p => p.ChannelEofReceived += null,
new MessageEventArgs<ChannelEofMessage>(new ChannelEofMessage(_localChannelNumber)));
SessionMock.Raise(p => p.ChannelEofReceived += null,
new MessageEventArgs<ChannelEofMessage>(new ChannelEofMessage(_localChannelNumber)));
}
private void Act()
protected override void Act()
{
_sessionMock.Raise(p => p.ChannelCloseReceived += null,
new MessageEventArgs<ChannelCloseMessage>(new ChannelCloseMessage(_localChannelNumber)));
SessionMock.Raise(p => p.ChannelCloseReceived += null,
new MessageEventArgs<ChannelCloseMessage>(new ChannelCloseMessage(_localChannelNumber)));
}
[TestMethod]
@@ -79,7 +88,7 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void TrySendMessageOnSessionShouldBeInvokedOnceForChannelCloseMessage()
{
_sessionMock.Verify(
SessionMock.Verify(
p => p.TrySendMessage(It.Is<ChannelCloseMessage>(c => c.LocalChannelNumber == _remoteChannelNumber)),
Times.Once);
}
@@ -87,15 +96,15 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void SendMessageOnSessionShouldNeverBeInvokedForChannelEofMessage()
{
_sessionMock.Verify(
SessionMock.Verify(
p => p.TrySendMessage(It.Is<ChannelEofMessage>(c => c.LocalChannelNumber == _remoteChannelNumber)),
Times.Never);
}
[TestMethod]
public void WaitOnHandleOnSessionShouldBeInvokedOnce()
public void TryWaitOnSessionShouldBeInvokedOnce()
{
_sessionMock.Verify(p => p.WaitOnHandle(It.IsAny<EventWaitHandle>()), Times.Once);
SessionMock.Verify(p => p.TryWait(It.IsAny<EventWaitHandle>(), _channelCloseTimeout), Times.Once);
}
[TestMethod]
@@ -110,5 +119,11 @@ namespace Renci.SshNet.Tests.Classes.Channels
{
Assert.AreEqual(0, _channelExceptionRegister.Count, _channelExceptionRegister.AsString());
}
[TestMethod]
public void ChannelCloseReceivedShouldBlockUntilClosedEventHandlerHasCompleted()
{
Assert.IsTrue(_channelClosedEventHandlerCompleted.WaitOne(0));
}
}
}
}
@@ -8,9 +8,8 @@ using Renci.SshNet.Messages.Connection;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelTest_OnSessionChannelDataReceived_OnData_Exception
public class ChannelTest_OnSessionChannelDataReceived_OnData_Exception : ChannelTestBase
{
private Mock<ISession> _sessionMock;
private uint _localWindowSize;
private uint _localPacketSize;
private uint _localChannelNumber;
@@ -18,33 +17,34 @@ namespace Renci.SshNet.Tests.Classes.Channels
private IList<ExceptionEventArgs> _channelExceptionRegister;
private Exception _onDataException;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localWindowSize = (uint)random.Next(1000, int.MaxValue);
_localWindowSize = (uint) random.Next(1000, int.MaxValue);
_localPacketSize = _localWindowSize - 1;
_localChannelNumber = (uint)random.Next(0, int.MaxValue);
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_onDataException = new SystemException();
_channelExceptionRegister = new List<ExceptionEventArgs>();
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
protected override void SetupMocks()
{
}
_channel = new ChannelStub(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelStub(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.OnDataException = _onDataException;
}
private void Act()
protected override void Act()
{
_sessionMock.Raise(s => s.ChannelDataReceived += null,
new MessageEventArgs<ChannelDataMessage>(new ChannelDataMessage(_localChannelNumber, new byte[0])));
SessionMock.Raise(s => s.ChannelDataReceived += null,
new MessageEventArgs<ChannelDataMessage>(new ChannelDataMessage(_localChannelNumber, new byte[0])));
}
[TestMethod]
@@ -61,4 +61,4 @@ namespace Renci.SshNet.Tests.Classes.Channels
Assert.AreSame(_onDataException, _channel.OnErrorOccurredInvocations[0]);
}
}
}
}
@@ -8,9 +8,8 @@ using Renci.SshNet.Messages.Connection;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelTest_OnSessionChannelEofReceived_Exception
public class ChannelTest_OnSessionChannelEofReceived_Exception : ChannelTestBase
{
private Mock<ISession> _sessionMock;
private uint _localWindowSize;
private uint _localPacketSize;
private uint _localChannelNumber;
@@ -21,38 +20,39 @@ namespace Renci.SshNet.Tests.Classes.Channels
private IList<ExceptionEventArgs> _channelExceptionRegister;
private Exception _onEofException;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localWindowSize = (uint)random.Next(0, 1000);
_localPacketSize = (uint)random.Next(1001, int.MaxValue);
_localChannelNumber = (uint)random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint)random.Next(0, int.MaxValue);
_remoteWindowSize = (uint)random.Next(0, int.MaxValue);
_remotePacketSize = (uint)random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(0, 1000);
_localPacketSize = (uint) random.Next(1001, int.MaxValue);
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint) random.Next(0, int.MaxValue);
_remoteWindowSize = (uint) random.Next(0, int.MaxValue);
_remotePacketSize = (uint) random.Next(0, int.MaxValue);
_onEofException = new SystemException();
_channelExceptionRegister = new List<ExceptionEventArgs>();
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
protected override void SetupMocks()
{
}
_channel = new ChannelStub(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelStub(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.InitializeRemoteChannelInfo(_remoteChannelNumber, _remoteWindowSize, _remotePacketSize);
_channel.SetIsOpen(true);
_channel.OnEofException = _onEofException;
}
private void Act()
protected override void Act()
{
_sessionMock.Raise(s => s.ChannelEofReceived += null,
new MessageEventArgs<ChannelEofMessage>(new ChannelEofMessage(_localChannelNumber)));
SessionMock.Raise(s => s.ChannelEofReceived += null,
new MessageEventArgs<ChannelEofMessage>(new ChannelEofMessage(_localChannelNumber)));
}
[TestMethod]
@@ -69,4 +69,4 @@ namespace Renci.SshNet.Tests.Classes.Channels
Assert.AreSame(_onEofException, _channel.OnErrorOccurredInvocations[0]);
}
}
}
}
@@ -8,9 +8,8 @@ using Renci.SshNet.Messages.Connection;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelTest_OnSessionChannelExtendedDataReceived_OnExtendedData_Exception
public class ChannelTest_OnSessionChannelExtendedDataReceived_OnExtendedData_Exception : ChannelTestBase
{
private Mock<ISession> _sessionMock;
private uint _localWindowSize;
private uint _localPacketSize;
private uint _localChannelNumber;
@@ -18,33 +17,34 @@ namespace Renci.SshNet.Tests.Classes.Channels
private IList<ExceptionEventArgs> _channelExceptionRegister;
private Exception _onExtendedDataException;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localWindowSize = (uint)random.Next(1000, int.MaxValue);
_localWindowSize = (uint) random.Next(1000, int.MaxValue);
_localPacketSize = _localWindowSize - 1;
_localChannelNumber = (uint)random.Next(0, int.MaxValue);
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_onExtendedDataException = new SystemException();
_channelExceptionRegister = new List<ExceptionEventArgs>();
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
protected override void SetupMocks()
{
}
_channel = new ChannelStub(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelStub(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.OnExtendedDataException = _onExtendedDataException;
}
private void Act()
protected override void Act()
{
_sessionMock.Raise(s => s.ChannelExtendedDataReceived += null,
new MessageEventArgs<ChannelExtendedDataMessage>(new ChannelExtendedDataMessage(_localChannelNumber, 5, new byte[0])));
SessionMock.Raise(s => s.ChannelExtendedDataReceived += null,
new MessageEventArgs<ChannelExtendedDataMessage>(new ChannelExtendedDataMessage(_localChannelNumber, 5, new byte[0])));
}
[TestMethod]
@@ -61,4 +61,4 @@ namespace Renci.SshNet.Tests.Classes.Channels
Assert.AreSame(_onExtendedDataException, _channel.OnErrorOccurredInvocations[0]);
}
}
}
}
@@ -8,9 +8,8 @@ using Renci.SshNet.Messages.Connection;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelTest_OnSessionChannelFailureReceived_OnFailure_Exception
public class ChannelTest_OnSessionChannelFailureReceived_OnFailure_Exception : ChannelTestBase
{
private Mock<ISession> _sessionMock;
private uint _localWindowSize;
private uint _localPacketSize;
private uint _localChannelNumber;
@@ -18,33 +17,34 @@ namespace Renci.SshNet.Tests.Classes.Channels
private IList<ExceptionEventArgs> _channelExceptionRegister;
private Exception _onFailureException;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localWindowSize = (uint)random.Next(0, 1000);
_localPacketSize = (uint)random.Next(1001, int.MaxValue);
_localChannelNumber = (uint)random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(0, 1000);
_localPacketSize = (uint) random.Next(1001, int.MaxValue);
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_onFailureException = new SystemException();
_channelExceptionRegister = new List<ExceptionEventArgs>();
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
protected override void SetupMocks()
{
}
_channel = new ChannelStub(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelStub(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.OnFailureException = _onFailureException;
}
private void Act()
protected override void Act()
{
_sessionMock.Raise(s => s.ChannelFailureReceived += null,
new MessageEventArgs<ChannelFailureMessage>(new ChannelFailureMessage(_localChannelNumber)));
SessionMock.Raise(s => s.ChannelFailureReceived += null,
new MessageEventArgs<ChannelFailureMessage>(new ChannelFailureMessage(_localChannelNumber)));
}
[TestMethod]
@@ -61,4 +61,4 @@ namespace Renci.SshNet.Tests.Classes.Channels
Assert.AreSame(_onFailureException, _channel.OnErrorOccurredInvocations[0]);
}
}
}
}
@@ -8,9 +8,8 @@ using Renci.SshNet.Messages.Connection;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelTest_OnSessionChannelRequestReceived_OnRequest_Exception
public class ChannelTest_OnSessionChannelRequestReceived_OnRequest_Exception : ChannelTestBase
{
private Mock<ISession> _sessionMock;
private uint _localWindowSize;
private uint _localPacketSize;
private uint _localChannelNumber;
@@ -19,36 +18,37 @@ namespace Renci.SshNet.Tests.Classes.Channels
private Exception _onRequestException;
private SignalRequestInfo _requestInfo;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localWindowSize = (uint)random.Next(1000, int.MaxValue);
_localWindowSize = (uint) random.Next(1000, int.MaxValue);
_localPacketSize = _localWindowSize - 1;
_localChannelNumber = (uint)random.Next(0, int.MaxValue);
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_onRequestException = new SystemException();
_channelExceptionRegister = new List<ExceptionEventArgs>();
_requestInfo = new SignalRequestInfo("ABC");
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
_sessionMock.Setup(p => p.ConnectionInfo)
.Returns(new ConnectionInfo("host", "user", new PasswordAuthenticationMethod("user", "password")));
protected override void SetupMocks()
{
SessionMock.Setup(p => p.ConnectionInfo)
.Returns(new ConnectionInfo("host", "user", new PasswordAuthenticationMethod("user", "password")));
}
_channel = new ChannelStub(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelStub(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.OnRequestException = _onRequestException;
}
private void Act()
protected override void Act()
{
_sessionMock.Raise(s => s.ChannelRequestReceived += null,
new MessageEventArgs<ChannelRequestMessage>(new ChannelRequestMessage(_localChannelNumber, _requestInfo)));
SessionMock.Raise(s => s.ChannelRequestReceived += null,
new MessageEventArgs<ChannelRequestMessage>(new ChannelRequestMessage(_localChannelNumber, _requestInfo)));
}
[TestMethod]
@@ -65,4 +65,4 @@ namespace Renci.SshNet.Tests.Classes.Channels
Assert.AreSame(_onRequestException, _channel.OnErrorOccurredInvocations[0]);
}
}
}
}
@@ -8,9 +8,8 @@ using Renci.SshNet.Messages.Connection;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelTest_OnSessionChannelSuccessReceived_OnSuccess_Exception
public class ChannelTest_OnSessionChannelSuccessReceived_OnSuccess_Exception : ChannelTestBase
{
private Mock<ISession> _sessionMock;
private uint _localWindowSize;
private uint _localPacketSize;
private uint _localChannelNumber;
@@ -18,33 +17,34 @@ namespace Renci.SshNet.Tests.Classes.Channels
private IList<ExceptionEventArgs> _channelExceptionRegister;
private Exception _onSuccessException;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint)random.Next(0, int.MaxValue);
_localWindowSize = (uint)random.Next(0, 1000);
_localPacketSize = (uint)random.Next(1001, int.MaxValue);
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(0, 1000);
_localPacketSize = (uint) random.Next(1001, int.MaxValue);
_onSuccessException = new SystemException();
_channelExceptionRegister = new List<ExceptionEventArgs>();
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
protected override void SetupMocks()
{
}
_channel = new ChannelStub(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelStub(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.OnSuccessException = _onSuccessException;
}
private void Act()
protected override void Act()
{
_sessionMock.Raise(s => s.ChannelSuccessReceived += null,
new MessageEventArgs<ChannelSuccessMessage>(new ChannelSuccessMessage(_localChannelNumber)));
SessionMock.Raise(s => s.ChannelSuccessReceived += null,
new MessageEventArgs<ChannelSuccessMessage>(new ChannelSuccessMessage(_localChannelNumber)));
}
[TestMethod]
@@ -61,4 +61,4 @@ namespace Renci.SshNet.Tests.Classes.Channels
Assert.AreSame(_onSuccessException, _channel.OnErrorOccurredInvocations[0]);
}
}
}
}
@@ -8,9 +8,8 @@ using Renci.SshNet.Messages.Connection;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelTest_OnSessionChannelWindowAdjustReceived_OnWindowAdjust_Exception
public class ChannelTest_OnSessionChannelWindowAdjustReceived_OnWindowAdjust_Exception : ChannelTestBase
{
private Mock<ISession> _sessionMock;
private uint _localChannelNumber;
private uint _localWindowSize;
private uint _localPacketSize;
@@ -22,38 +21,39 @@ namespace Renci.SshNet.Tests.Classes.Channels
private Exception _onWindowAdjustException;
private uint _bytesToAdd;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint)random.Next(0, int.MaxValue);
_localWindowSize = (uint)random.Next(1000, int.MaxValue);
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(1000, int.MaxValue);
_localPacketSize = _localWindowSize - 1;
_remoteChannelNumber = (uint)random.Next(0, int.MaxValue);
_remoteWindowSize = (uint)random.Next(1000, int.MaxValue);
_remoteChannelNumber = (uint) random.Next(0, int.MaxValue);
_remoteWindowSize = (uint) random.Next(1000, int.MaxValue);
_remotePacketSize = _localWindowSize - 1;
_bytesToAdd = (uint)random.Next(0, int.MaxValue);
_bytesToAdd = (uint) random.Next(0, int.MaxValue);
_onWindowAdjustException = new SystemException();
_channelExceptionRegister = new List<ExceptionEventArgs>();
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
protected override void SetupMocks()
{
}
_channel = new ChannelStub(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelStub(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.InitializeRemoteChannelInfo(_remoteChannelNumber, _remoteWindowSize, _remotePacketSize);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.OnWindowAdjustException = _onWindowAdjustException;
}
private void Act()
protected override void Act()
{
_sessionMock.Raise(s => s.ChannelWindowAdjustReceived += null,
new MessageEventArgs<ChannelWindowAdjustMessage>(new ChannelWindowAdjustMessage(_localChannelNumber, _bytesToAdd)));
SessionMock.Raise(s => s.ChannelWindowAdjustReceived += null,
new MessageEventArgs<ChannelWindowAdjustMessage>(new ChannelWindowAdjustMessage(_localChannelNumber, _bytesToAdd)));
}
[TestMethod]
@@ -70,4 +70,4 @@ namespace Renci.SshNet.Tests.Classes.Channels
Assert.AreSame(_onWindowAdjustException, _channel.OnErrorOccurredInvocations[0]);
}
}
}
}
@@ -7,9 +7,8 @@ using Renci.SshNet.Common;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelTest_OnSessionDisconnected_OnDisconnected_Exception
public class ChannelTest_OnSessionDisconnected_OnDisconnected_Exception : ChannelTestBase
{
private Mock<ISession> _sessionMock;
private uint _localWindowSize;
private uint _localPacketSize;
private uint _localChannelNumber;
@@ -17,32 +16,33 @@ namespace Renci.SshNet.Tests.Classes.Channels
private IList<ExceptionEventArgs> _channelExceptionRegister;
private Exception _onDisconnectedException;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localWindowSize = (uint)random.Next(1000, int.MaxValue);
_localWindowSize = (uint) random.Next(1000, int.MaxValue);
_localPacketSize = _localWindowSize - 1;
_localChannelNumber = (uint)random.Next(0, int.MaxValue);
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_onDisconnectedException = new SystemException();
_channelExceptionRegister = new List<ExceptionEventArgs>();
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
protected override void SetupMocks()
{
}
_channel = new ChannelStub(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelStub(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.OnDisconnectedException = _onDisconnectedException;
}
private void Act()
protected override void Act()
{
_sessionMock.Raise(s => s.Disconnected += null, EventArgs.Empty);
SessionMock.Raise(s => s.Disconnected += null, EventArgs.Empty);
}
[TestMethod]
@@ -59,4 +59,4 @@ namespace Renci.SshNet.Tests.Classes.Channels
Assert.AreSame(_onDisconnectedException, _channel.OnErrorOccurredInvocations[0]);
}
}
}
}
@@ -7,9 +7,8 @@ using Renci.SshNet.Common;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelTest_OnSessionDisconnected_SessionIsConnectedAndChannelIsOpen
public class ChannelTest_OnSessionDisconnected_SessionIsConnectedAndChannelIsOpen : ChannelTestBase
{
private Mock<ISession> _sessionMock;
private uint _localChannelNumber;
private uint _localWindowSize;
private uint _localPacketSize;
@@ -20,39 +19,39 @@ namespace Renci.SshNet.Tests.Classes.Channels
private List<ChannelEventArgs> _channelClosedRegister;
private IList<ExceptionEventArgs> _channelExceptionRegister;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint)random.Next(0, int.MaxValue);
_localWindowSize = (uint)random.Next(0, int.MaxValue);
_localPacketSize = (uint)random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint)random.Next(0, int.MaxValue);
_remoteWindowSize = (uint)random.Next(0, int.MaxValue);
_remotePacketSize = (uint)random.Next(0, int.MaxValue);
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(0, int.MaxValue);
_localPacketSize = (uint) random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint) random.Next(0, int.MaxValue);
_remoteWindowSize = (uint) random.Next(0, int.MaxValue);
_remotePacketSize = (uint) random.Next(0, int.MaxValue);
_channelClosedRegister = new List<ChannelEventArgs>();
_channelExceptionRegister = new List<ExceptionEventArgs>();
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
protected override void SetupMocks()
{
SessionMock.Setup(p => p.IsConnected).Returns(true);
}
_sessionMock.Setup(p => p.IsConnected).Returns(true);
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelStub(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel = new ChannelStub(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) => _channelClosedRegister.Add(args);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.InitializeRemoteChannelInfo(_remoteChannelNumber, _remoteWindowSize, _remotePacketSize);
_channel.SetIsOpen(true);
}
private void Act()
protected override void Act()
{
_sessionMock.Raise(s => s.Disconnected += null, EventArgs.Empty);
SessionMock.Raise(s => s.Disconnected += null, EventArgs.Empty);
}
[TestMethod]
@@ -73,4 +72,4 @@ namespace Renci.SshNet.Tests.Classes.Channels
Assert.AreEqual(0, _channelExceptionRegister.Count);
}
}
}
}
@@ -1,15 +1,13 @@
using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Renci.SshNet.Common;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelTest_OnSessionErrorOccurred_OnErrorOccurred_Exception
public class ChannelTest_OnSessionErrorOccurred_OnErrorOccurred_Exception : ChannelTestBase
{
private Mock<ISession> _sessionMock;
private uint _localWindowSize;
private uint _localPacketSize;
private uint _localChannelNumber;
@@ -18,33 +16,34 @@ namespace Renci.SshNet.Tests.Classes.Channels
private Exception _onErrorOccurredException;
private Exception _errorOccurredException;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localWindowSize = (uint)random.Next(1000, int.MaxValue);
_localWindowSize = (uint) random.Next(1000, int.MaxValue);
_localPacketSize = _localWindowSize - 1;
_localChannelNumber = (uint)random.Next(0, int.MaxValue);
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_onErrorOccurredException = new SystemException();
_channelExceptionRegister = new List<ExceptionEventArgs>();
_errorOccurredException = new SystemException();
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
protected override void SetupMocks()
{
}
_channel = new ChannelStub(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelStub(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.OnErrorOccurredException = _onErrorOccurredException;
}
private void Act()
protected override void Act()
{
_sessionMock.Raise(s => s.ErrorOccured += null, new ExceptionEventArgs(_errorOccurredException));
SessionMock.Raise(s => s.ErrorOccured += null, new ExceptionEventArgs(_errorOccurredException));
}
[TestMethod]
@@ -61,4 +60,4 @@ namespace Renci.SshNet.Tests.Classes.Channels
Assert.AreSame(_errorOccurredException, _channel.OnErrorOccurredInvocations[0]);
}
}
}
}
@@ -8,9 +8,8 @@ using Renci.SshNet.Messages;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelTest_SendEof_ChannelIsNotOpen
public class ChannelTest_SendEof_ChannelIsNotOpen : ChannelTestBase
{
private Mock<ISession> _sessionMock;
private uint _localWindowSize;
private uint _localPacketSize;
private uint _localChannelNumber;
@@ -19,31 +18,32 @@ namespace Renci.SshNet.Tests.Classes.Channels
private IList<ExceptionEventArgs> _channelExceptionRegister;
private InvalidOperationException _actualException;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint)random.Next(0, int.MaxValue);
_localWindowSize = (uint)random.Next(0, int.MaxValue);
_localPacketSize = (uint)random.Next(0, int.MaxValue);
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(0, int.MaxValue);
_localPacketSize = (uint) random.Next(0, int.MaxValue);
_channelClosedRegister = new List<ChannelEventArgs>();
_channelExceptionRegister = new List<ExceptionEventArgs>();
_actualException = null;
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
protected override void SetupMocks()
{
}
_channel = new ChannelStub(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelStub(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) => _channelClosedRegister.Add(args);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
}
private void Act()
protected override void Act()
{
try
{
@@ -73,7 +73,7 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void SendMessageOnSessionShouldNeverBeInvoked()
{
_sessionMock.Verify(p => p.SendMessage(It.IsAny<Message>()), Times.Never);
SessionMock.Verify(p => p.SendMessage(It.IsAny<Message>()), Times.Never);
}
[TestMethod]
@@ -88,4 +88,4 @@ namespace Renci.SshNet.Tests.Classes.Channels
Assert.AreEqual(0, _channelExceptionRegister.Count);
}
}
}
}
@@ -8,9 +8,8 @@ using Renci.SshNet.Messages.Connection;
namespace Renci.SshNet.Tests.Classes.Channels
{
[TestClass]
public class ChannelTest_SendEof_ChannelIsOpen
public class ChannelTest_SendEof_ChannelIsOpen : ChannelTestBase
{
private Mock<ISession> _sessionMock;
private uint _localChannelNumber;
private uint _localWindowSize;
private uint _localPacketSize;
@@ -21,37 +20,37 @@ namespace Renci.SshNet.Tests.Classes.Channels
private List<ChannelEventArgs> _channelClosedRegister;
private IList<ExceptionEventArgs> _channelExceptionRegister;
[TestInitialize]
public void Initialize()
{
Arrange();
Act();
}
private void Arrange()
protected override void SetupData()
{
var random = new Random();
_localChannelNumber = (uint)random.Next(0, int.MaxValue);
_localWindowSize = (uint)random.Next(0, int.MaxValue);
_localPacketSize = (uint)random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint)random.Next(0, int.MaxValue);
_remoteWindowSize = (uint)random.Next(0, int.MaxValue);
_remotePacketSize = (uint)random.Next(0, int.MaxValue);
_localChannelNumber = (uint) random.Next(0, int.MaxValue);
_localWindowSize = (uint) random.Next(0, int.MaxValue);
_localPacketSize = (uint) random.Next(0, int.MaxValue);
_remoteChannelNumber = (uint) random.Next(0, int.MaxValue);
_remoteWindowSize = (uint) random.Next(0, int.MaxValue);
_remotePacketSize = (uint) random.Next(0, int.MaxValue);
_channelClosedRegister = new List<ChannelEventArgs>();
_channelExceptionRegister = new List<ExceptionEventArgs>();
}
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
protected override void SetupMocks()
{
SessionMock.Setup(p => p.SendMessage(It.Is<ChannelEofMessage>(e => e.LocalChannelNumber == _remoteChannelNumber)));
}
_sessionMock.Setup(p => p.SendMessage(It.Is<ChannelEofMessage>(e => e.LocalChannelNumber == _remoteChannelNumber)));
protected override void Arrange()
{
base.Arrange();
_channel = new ChannelStub(_sessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel = new ChannelStub(SessionMock.Object, _localChannelNumber, _localWindowSize, _localPacketSize);
_channel.Closed += (sender, args) => _channelClosedRegister.Add(args);
_channel.Exception += (sender, args) => _channelExceptionRegister.Add(args);
_channel.InitializeRemoteChannelInfo(_remoteChannelNumber, _remoteWindowSize, _remotePacketSize);
_channel.SetIsOpen(true);
}
private void Act()
protected override void Act()
{
_channel.SendEof();
}
@@ -65,7 +64,7 @@ namespace Renci.SshNet.Tests.Classes.Channels
[TestMethod]
public void SendMessageOnSessionShouldBeInvokedOnceWithChannelEofMessage()
{
_sessionMock.Verify(
SessionMock.Verify(
p => p.SendMessage(It.Is<ChannelEofMessage>(e => e.LocalChannelNumber == _remoteChannelNumber)),
Times.Once);
}
@@ -82,4 +81,4 @@ namespace Renci.SshNet.Tests.Classes.Channels
Assert.AreEqual(0, _channelExceptionRegister.Count);
}
}
}
}
@@ -35,7 +35,6 @@ namespace Renci.SshNet.Tests.Classes
{
private int _partialSuccessLimit;
private ClientAuthentication _clientAuthentication;
private SshAuthenticationException _actualException;
protected override void SetupData()
{
@@ -0,0 +1,32 @@
using System;
using System.Diagnostics.CodeAnalysis;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Renci.SshNet.Common;
namespace Renci.SshNet.Tests.Classes.Common
{
[TestClass]
[SuppressMessage("ReSharper", "InvokeAsExtensionMethod")]
public class ExtensionsTest_Pad
{
[TestMethod]
public void ShouldReturnNotPadded()
{
byte[] value = {0x0a, 0x0d};
byte[] padded = value.Pad(2);
Assert.AreEqual(value, padded);
Assert.AreEqual(value.Length, padded.Length);
}
[TestMethod]
public void ShouldReturnPadded()
{
byte[] value = { 0x0a, 0x0d };
byte[] padded = value.Pad(3);
Assert.AreEqual(value.Length + 1, padded.Length);
Assert.AreEqual(0x00, padded[0]);
Assert.AreEqual(0x0a, padded[1]);
Assert.AreEqual(0x0d, padded[2]);
}
}
}
@@ -0,0 +1,40 @@
using System;
using System.Diagnostics.CodeAnalysis;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Renci.SshNet.Common;
namespace Renci.SshNet.Tests.Classes.Common
{
[TestClass]
[SuppressMessage("ReSharper", "InvokeAsExtensionMethod")]
public class ExtensionsTest_ToBigInteger2
{
[TestMethod]
public void ShouldNotAppendZero()
{
byte[] value = { 0x0a, 0x0d };
var actual = value.ToBigInteger2().ToByteArray().Reverse();
Assert.IsNotNull(actual);
Assert.AreEqual(2, actual.Length);
Assert.AreEqual(0x0a, actual[0]);
Assert.AreEqual(0x0d, actual[1]);
}
[TestMethod]
public void ShouldAppendZero()
{
byte[] value = { 0xff, 0x0a, 0x0d };
var actual = value.ToBigInteger2().ToByteArray().Reverse();
Assert.IsNotNull(actual);
Assert.AreEqual(4, actual.Length);
Assert.AreEqual(0x00, actual[0]);
Assert.AreEqual(0xff, actual[1]);
Assert.AreEqual(0x0a, actual[2]);
Assert.AreEqual(0x0d, actual[3]);
}
}
}
@@ -0,0 +1,177 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Renci.SshNet.Common;
using System;
namespace Renci.SshNet.Tests.Classes.Common
{
[TestClass]
public class PosixPathTest_CreateAbsoluteOrRelativeFilePath
{
[TestMethod]
public void Path_Null()
{
const string path = null;
try
{
PosixPath.CreateAbsoluteOrRelativeFilePath(path);
Assert.Fail();
}
catch (ArgumentNullException ex)
{
Assert.IsNull(ex.InnerException);
Assert.AreEqual("path", ex.ParamName);
}
}
[TestMethod]
public void Path_Empty()
{
var path = string.Empty;
try
{
PosixPath.CreateAbsoluteOrRelativeFilePath(path);
Assert.Fail();
}
catch (ArgumentException ex)
{
Assert.IsNull(ex.InnerException);
Assert.AreEqual(string.Format("The path is a zero-length string.{0}Parameter name: {1}", Environment.NewLine, ex.ParamName), ex.Message);
Assert.AreEqual("path", ex.ParamName);
}
}
[TestMethod]
public void Path_TrailingForwardSlash()
{
var path = "/abc/";
var actual = PosixPath.CreateAbsoluteOrRelativeFilePath(path);
Assert.IsNotNull(actual);
Assert.AreEqual("/abc", actual.Directory);
Assert.IsNull(actual.File);
}
[TestMethod]
public void Path_FileWithoutNoDirectory()
{
var path = "abc.log";
var actual = PosixPath.CreateAbsoluteOrRelativeFilePath(path);
Assert.IsNotNull(actual);
Assert.AreEqual(".", actual.Directory);
Assert.AreSame(path, actual.File);
}
[TestMethod]
public void Path_FileInRootDirectory()
{
var path = "/abc.log";
var actual = PosixPath.CreateAbsoluteOrRelativeFilePath(path);
Assert.IsNotNull(actual);
Assert.AreEqual("/", actual.Directory);
Assert.AreEqual("abc.log", actual.File);
}
[TestMethod]
public void Path_RootDirectoryOnly()
{
var path = "/";
var actual = PosixPath.CreateAbsoluteOrRelativeFilePath(path);
Assert.IsNotNull(actual);
Assert.AreEqual("/", actual.Directory);
Assert.IsNull(actual.File);
}
[TestMethod]
public void Path_FileInNonRootDirectory()
{
var path = "/home/sshnet/xyz";
var actual = PosixPath.CreateAbsoluteOrRelativeFilePath(path);
Assert.IsNotNull(actual);
Assert.AreEqual("/home/sshnet", actual.Directory);
Assert.AreEqual("xyz", actual.File);
}
[TestMethod]
public void Path_BackslashIsNotConsideredDirectorySeparator()
{
var path = "/home\\abc.log";
var actual = PosixPath.CreateAbsoluteOrRelativeFilePath(path);
Assert.IsNotNull(actual);
Assert.AreEqual("/", actual.Directory);
Assert.AreEqual("home\\abc.log", actual.File);
}
[TestMethod]
public void Path_ColonIsNotConsideredPathSeparator()
{
var path = "/home:abc.log";
var actual = PosixPath.CreateAbsoluteOrRelativeFilePath(path);
Assert.IsNotNull(actual);
Assert.AreEqual("/", actual.Directory);
Assert.AreEqual("home:abc.log", actual.File);
}
[TestMethod]
public void Path_LeadingWhitespace()
{
var path = " / \tabc";
var actual = PosixPath.CreateAbsoluteOrRelativeFilePath(path);
Assert.IsNotNull(actual);
Assert.AreEqual(" ", actual.Directory);
Assert.AreEqual(" \tabc", actual.File);
}
[TestMethod]
public void Path_TrailingWhitespace()
{
var path = "/abc \t ";
var actual = PosixPath.CreateAbsoluteOrRelativeFilePath(path);
Assert.IsNotNull(actual);
Assert.AreEqual("/", actual.Directory);
Assert.AreEqual("abc \t ", actual.File);
}
[TestMethod]
public void Path_OnlyWhitespace()
{
var path = " ";
var actual = PosixPath.CreateAbsoluteOrRelativeFilePath(path);
Assert.IsNotNull(actual);
Assert.AreEqual(".", actual.Directory);
Assert.AreSame(path, actual.File);
}
[TestMethod]
public void Path_FileNameOnlyWhitespace()
{
var path = "/home/\t ";
var actual = PosixPath.CreateAbsoluteOrRelativeFilePath(path);
Assert.IsNotNull(actual);
Assert.AreEqual("/home", actual.Directory);
Assert.AreEqual("\t ", actual.File);
}
}
}
@@ -0,0 +1,159 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Renci.SshNet.Common;
namespace Renci.SshNet.Tests.Classes.Common
{
[TestClass]
public class PosixPathTest_GetDirectoryName
{
[TestMethod]
public void Path_Null()
{
const string path = null;
try
{
PosixPath.GetDirectoryName(path);
Assert.Fail();
}
catch (ArgumentNullException ex)
{
Assert.IsNull(ex.InnerException);
Assert.AreEqual("path", ex.ParamName);
}
}
[TestMethod]
public void Path_Empty()
{
var path = string.Empty;
var actual = PosixPath.GetDirectoryName(path);
Assert.IsNotNull(actual);
Assert.AreEqual(".", actual);
}
[TestMethod]
public void Path_TrailingForwardSlash()
{
var path = "/abc/";
var actual = PosixPath.GetDirectoryName(path);
Assert.IsNotNull(actual);
Assert.AreEqual("/abc", actual);
}
[TestMethod]
public void Path_FileWithoutNoDirectory()
{
var path = "abc.log";
var actual = PosixPath.GetDirectoryName(path);
Assert.IsNotNull(actual);
Assert.AreEqual(".", actual);
}
[TestMethod]
public void Path_FileInRootDirectory()
{
var path = "/abc.log";
var actual = PosixPath.GetDirectoryName(path);
Assert.IsNotNull(actual);
Assert.AreEqual("/", actual);
}
[TestMethod]
public void Path_RootDirectoryOnly()
{
var path = "/";
var actual = PosixPath.GetDirectoryName(path);
Assert.IsNotNull(actual);
Assert.AreEqual("/", actual);
}
[TestMethod]
public void Path_FileInNonRootDirectory()
{
var path = "/home/sshnet/xyz";
var actual = PosixPath.GetDirectoryName(path);
Assert.IsNotNull(actual);
Assert.AreEqual("/home/sshnet", actual);
}
[TestMethod]
public void Path_BackslashIsNotConsideredDirectorySeparator()
{
var path = "/home\\abc.log";
var actual = PosixPath.GetDirectoryName(path);
Assert.IsNotNull(actual);
Assert.AreEqual("/", actual);
}
[TestMethod]
public void Path_ColonIsNotConsideredPathSeparator()
{
var path = "/home:abc.log";
var actual = PosixPath.GetDirectoryName(path);
Assert.IsNotNull(actual);
Assert.AreEqual("/", actual);
}
[TestMethod]
public void Path_LeadingWhitespace()
{
var path = " / \tabc";
var actual = PosixPath.GetDirectoryName(path);
Assert.IsNotNull(actual);
Assert.AreEqual(" ", actual);
}
[TestMethod]
public void Path_TrailingWhitespace()
{
var path = "/abc \t ";
var actual = PosixPath.GetDirectoryName(path);
Assert.IsNotNull(actual);
Assert.AreEqual("/", actual);
}
[TestMethod]
public void Path_OnlyWhitespace()
{
var path = " ";
var actual = PosixPath.GetDirectoryName(path);
Assert.IsNotNull(actual);
Assert.AreEqual(".", actual);
}
[TestMethod]
public void Path_FileNameOnlyWhitespace()
{
var path = "/home/\t ";
var actual = PosixPath.GetDirectoryName(path);
Assert.IsNotNull(actual);
Assert.AreEqual("/home", actual);
}
}
}
@@ -17,8 +17,10 @@ namespace Renci.SshNet.Tests.Classes.Common
PosixPath.GetFileName(path);
Assert.Fail();
}
catch (NullReferenceException)
catch (ArgumentNullException ex)
{
Assert.IsNull(ex.InnerException);
Assert.AreEqual("path", ex.ParamName);
}
}
@@ -1,8 +0,0 @@
using Renci.SshNet.Tests.Common;
namespace Renci.SshNet.Tests.Classes.Common
{
public partial class ProxyExceptionTest : TestBase
{
}
}
@@ -1,103 +0,0 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Net;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Renci.SshNet.Common;
using Renci.SshNet.Tests.Properties;
namespace Renci.SshNet.Tests.Classes
{
public partial class ForwardedPortLocalTest
{
[TestMethod]
[TestCategory("integration")]
[ExpectedException(typeof(SshConnectionException))]
public void Test_PortForwarding_Local_Without_Connecting()
{
using (var client = new SshClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
{
var port1 = new ForwardedPortLocal("localhost", 8084, "www.renci.org", 80);
client.AddForwardedPort(port1);
port1.Exception += delegate(object sender, ExceptionEventArgs e)
{
Assert.Fail(e.Exception.ToString());
};
port1.Start();
System.Threading.Tasks.Parallel.For(0, 100,
//new ParallelOptions
//{
// MaxDegreeOfParallelism = 20,
//},
(counter) =>
{
var start = DateTime.Now;
var req = HttpWebRequest.Create("http://localhost:8084");
using (var response = req.GetResponse())
{
var data = ReadStream(response.GetResponseStream());
var end = DateTime.Now;
Debug.WriteLine(string.Format("Request# {2}: Lenght: {0} Time: {1}", data.Length, (end - start), counter));
}
}
);
}
}
[TestMethod]
[TestCategory("integration")]
public void Test_PortForwarding_Local()
{
using (var client = new SshClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
{
client.Connect();
var port1 = new ForwardedPortLocal("localhost", 8084, "www.renci.org", 80);
client.AddForwardedPort(port1);
port1.Exception += delegate(object sender, ExceptionEventArgs e)
{
Assert.Fail(e.Exception.ToString());
};
port1.Start();
System.Threading.Tasks.Parallel.For(0, 100,
//new ParallelOptions
//{
// MaxDegreeOfParallelism = 20,
//},
(counter) =>
{
var start = DateTime.Now;
var req = HttpWebRequest.Create("http://localhost:8084");
using (var response = req.GetResponse())
{
var data = ReadStream(response.GetResponseStream());
var end = DateTime.Now;
Debug.WriteLine(string.Format("Request# {2}: Length: {0} Time: {1}", data.Length, (end - start), counter));
}
}
);
}
}
private static byte[] ReadStream(Stream stream)
{
byte[] buffer = new byte[1024];
using (var ms = new MemoryStream())
{
while (true)
{
int read = stream.Read(buffer, 0, buffer.Length);
if (read > 0)
ms.Write(buffer, 0, read);
else
return ms.ToArray();
}
}
}
}
}
@@ -187,5 +187,97 @@ namespace Renci.SshNet.Tests.Classes
}
Assert.Inconclusive("TODO: Implement code to verify target");
}
#if FEATURE_TPL
[TestMethod]
[TestCategory("integration")]
[ExpectedException(typeof(SshConnectionException))]
public void Test_PortForwarding_Local_Without_Connecting()
{
using (var client = new SshClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
{
var port1 = new ForwardedPortLocal("localhost", 8084, "www.renci.org", 80);
client.AddForwardedPort(port1);
port1.Exception += delegate (object sender, ExceptionEventArgs e)
{
Assert.Fail(e.Exception.ToString());
};
port1.Start();
System.Threading.Tasks.Parallel.For(0, 100,
//new ParallelOptions
//{
// MaxDegreeOfParallelism = 20,
//},
(counter) =>
{
var start = DateTime.Now;
var req = HttpWebRequest.Create("http://localhost:8084");
using (var response = req.GetResponse())
{
var data = ReadStream(response.GetResponseStream());
var end = DateTime.Now;
Debug.WriteLine(string.Format("Request# {2}: Lenght: {0} Time: {1}", data.Length, (end - start), counter));
}
}
);
}
}
[TestMethod]
[TestCategory("integration")]
public void Test_PortForwarding_Local()
{
using (var client = new SshClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
{
client.Connect();
var port1 = new ForwardedPortLocal("localhost", 8084, "www.renci.org", 80);
client.AddForwardedPort(port1);
port1.Exception += delegate (object sender, ExceptionEventArgs e)
{
Assert.Fail(e.Exception.ToString());
};
port1.Start();
System.Threading.Tasks.Parallel.For(0, 100,
//new ParallelOptions
//{
// MaxDegreeOfParallelism = 20,
//},
(counter) =>
{
var start = DateTime.Now;
var req = HttpWebRequest.Create("http://localhost:8084");
using (var response = req.GetResponse())
{
var data = ReadStream(response.GetResponseStream());
var end = DateTime.Now;
Debug.WriteLine(string.Format("Request# {2}: Length: {0} Time: {1}", data.Length, (end - start), counter));
}
}
);
}
}
private static byte[] ReadStream(System.IO.Stream stream)
{
byte[] buffer = new byte[1024];
using (var ms = new System.IO.MemoryStream())
{
while (true)
{
int read = stream.Read(buffer, 0, buffer.Length);
if (read > 0)
ms.Write(buffer, 0, read);
else
return ms.ToArray();
}
}
}
#endif // FEATURE_TPL
}
}
@@ -1,51 +0,0 @@
using System;
using System.Diagnostics;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Renci.SshNet.Common;
using Renci.SshNet.Tests.Properties;
namespace Renci.SshNet.Tests.Classes
{
public partial class ForwardedPortRemoteTest
{
[TestMethod]
[TestCategory("integration")]
public void Test_PortForwarding_Remote()
{
// ******************************************************************
// ************* Tests are still in not finished ********************
// ******************************************************************
using (var client = new SshClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
{
client.Connect();
var port1 = new ForwardedPortRemote(8082, "www.renci.org", 80);
client.AddForwardedPort(port1);
port1.Exception += delegate(object sender, ExceptionEventArgs e)
{
Assert.Fail(e.Exception.ToString());
};
port1.Start();
var boundport = port1.BoundPort;
System.Threading.Tasks.Parallel.For(0, 5,
//new ParallelOptions
//{
// MaxDegreeOfParallelism = 1,
//},
(counter) =>
{
var cmd = client.CreateCommand(string.Format("wget -O- http://localhost:{0}", boundport));
var result = cmd.Execute();
var end = DateTime.Now;
Debug.WriteLine(string.Format("Length: {0}", result.Length));
}
);
Thread.Sleep(1000 * 100);
port1.Stop();
}
}
}
}
@@ -150,5 +150,46 @@ namespace Renci.SshNet.Tests.Classes
ForwardedPortRemote target = new ForwardedPortRemote(boundPort, host, port);
Assert.Inconclusive("TODO: Implement code to verify target");
}
#if FEATURE_TPL
[TestMethod]
[TestCategory("integration")]
public void Test_PortForwarding_Remote()
{
// ******************************************************************
// ************* Tests are still in not finished ********************
// ******************************************************************
using (var client = new SshClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
{
client.Connect();
var port1 = new ForwardedPortRemote(8082, "www.renci.org", 80);
client.AddForwardedPort(port1);
port1.Exception += delegate (object sender, ExceptionEventArgs e)
{
Assert.Fail(e.Exception.ToString());
};
port1.Start();
var boundport = port1.BoundPort;
System.Threading.Tasks.Parallel.For(0, 5,
//new ParallelOptions
//{
// MaxDegreeOfParallelism = 1,
//},
(counter) =>
{
var cmd = client.CreateCommand(string.Format("wget -O- http://localhost:{0}", boundport));
var result = cmd.Execute();
var end = DateTime.Now;
System.Diagnostics.Debug.WriteLine(string.Format("Length: {0}", result.Length));
}
);
Thread.Sleep(1000 * 100);
port1.Stop();
}
}
#endif // FEATURE_TPL
}
}
@@ -3,14 +3,15 @@ using Renci.SshNet.Common;
using Renci.SshNet.Messages.Connection;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using Renci.SshNet.Abstractions;
using Renci.SshNet.Tests.Common;
namespace Renci.SshNet.Tests.Classes.Messages.Connection
{
/// <summary>
///This is a test class for ChannelDataMessageTest and is intended
///to contain all ChannelDataMessageTest Unit Tests
///</summary>
/// This is a test class for ChannelDataMessageTest and is intended
/// to contain all ChannelDataMessageTest Unit Tests
/// </summary>
[TestClass]
public class ChannelDataMessageTest : TestBase
{
@@ -98,10 +99,9 @@ namespace Renci.SshNet.Tests.Classes.Messages.Connection
var random = new Random();
var localChannelNumber = (uint) random.Next(0, int.MaxValue);
var data = new byte[random.Next(10, 20)];
random.NextBytes(data);
var offset = random.Next(2, 4);
var size = random.Next(5, 9);
var data = CryptoAbstraction.GenerateRandom(random.Next(10, 20));
var offset = random.Next(0, data.Length - 1);
var size = random.Next(0, data.Length - offset);
var target = new ChannelDataMessage(localChannelNumber, data, offset, size);
@@ -133,11 +133,10 @@ namespace Renci.SshNet.Tests.Classes.Messages.Connection
var random = new Random();
var localChannelNumber = (uint) random.Next(0, int.MaxValue);
var data = new byte[random.Next(10, 20)];
random.NextBytes(data);
var data = CryptoAbstraction.GenerateRandom(random.Next(10, 20));
var offset = random.Next(2, 4);
var size = random.Next(5, 9);
var offset = random.Next(0, data.Length - 1);
var size = random.Next(0, data.Length - offset);
var channelDataMessage = new ChannelDataMessage(localChannelNumber, data, offset, size);
var bytes = channelDataMessage.GetBytes();
var target = new ChannelDataMessage();
@@ -1,5 +1,4 @@
using System.Collections.Generic;
using System.Text;
using System.Text;
using Renci.SshNet.Common;
using Renci.SshNet.Messages.Transport;
@@ -1,8 +1,6 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Renci.SshNet.Common;
using Renci.SshNet.Messages.Transport;
using Renci.SshNet.Tests.Common;
using System.Globalization;
using System.Linq;
namespace Renci.SshNet.Tests.Classes.Messages.Transport
@@ -25,7 +23,7 @@ namespace Renci.SshNet.Tests.Classes.Messages.Transport
Assert.IsTrue(m.HostKey.SequenceEqual(new byte[] { 0x00, 0x00, 0x00, 0x07, 0x73, 0x73, 0x68, 0x2d, 0x72, 0x73, 0x61, 0x00, 0x00, 0x00, 0x03, 0x01, 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x00, 0xce, 0x38, 0xdf, 0x0d, 0x04, 0x2c, 0x10, 0x45, 0x8f, 0x5e, 0xeb, 0xc2, 0x35, 0x01, 0xd5, 0x4d, 0x09, 0xa3, 0xee, 0x74, 0x3d, 0x75, 0xcf, 0xf4, 0xf3, 0x4f, 0xc9, 0xf9, 0x2e, 0x59, 0xd6, 0xb8, 0x69, 0x85, 0x16, 0xac, 0x33, 0x5b, 0x2a, 0x2a, 0xf8, 0x9c, 0xc4, 0xc3, 0x87, 0xd6, 0xb8, 0x50, 0x6c, 0xed, 0x60, 0x9c, 0x0f, 0x83, 0x37, 0xb3, 0xa2, 0x25, 0xbe, 0x07, 0xde, 0xb6, 0x1f, 0x28, 0xab, 0x05, 0x21, 0xc0, 0x23, 0xf7, 0xd6, 0xca, 0xcb, 0x03, 0x42, 0x69, 0x31, 0x93, 0x2b, 0x3b, 0x94, 0xb8, 0x3b, 0x90, 0xe6, 0x25, 0x7c, 0x23, 0xc5, 0x24, 0x89, 0x65, 0x37, 0x7b, 0x56, 0x54, 0xa2, 0x23, 0xcb, 0xeb, 0xf0, 0xe9, 0xd1, 0x07, 0x88, 0x36, 0x8f, 0xef, 0x65, 0x71, 0xac, 0x80, 0x5c, 0x81, 0x0a, 0x95, 0x1c, 0xf5, 0xc0, 0x5d, 0xd3, 0xd4, 0x10, 0x0e, 0x4f, 0xcf, 0x87, 0x80, 0xa5, 0xde, 0x6e, 0xff, 0x89, 0x9c, 0xfc, 0x2f, 0x85, 0xf5, 0x93, 0xff, 0x70, 0x8e, 0x48, 0xb6, 0x6e, 0x6e, 0x0a, 0x18, 0xa3, 0xbb, 0x1c, 0x56, 0x60, 0xf1, 0x9d, 0x2a, 0xca, 0xbf, 0xa0, 0x84, 0x73, 0xb1, 0x6d, 0x10, 0x75, 0xcc, 0xa3, 0x20, 0xed, 0x00, 0x52, 0xd0, 0x84, 0x5a, 0xc9, 0xbb, 0x17, 0x84, 0x96, 0x40, 0x48, 0xe2, 0x8e, 0x84, 0x30, 0x82, 0x3b, 0x87, 0xa4, 0x54, 0x55, 0x8c, 0xb5, 0x62, 0x97, 0xd7, 0xf1, 0xa3, 0x8b, 0x44, 0xaa, 0x34, 0xfd, 0xe9, 0xad, 0xda, 0xeb, 0x45, 0x27, 0xfb, 0xad, 0xea, 0x9a, 0x0c, 0x38, 0x30, 0x27, 0x6a, 0x82, 0xc2, 0xc2, 0x0a, 0xa0, 0xed, 0x30, 0x2f, 0x50, 0x9f, 0xdb, 0x1a, 0xfb, 0x29, 0x1c, 0x8a, 0x28, 0x3f, 0xd6, 0xf6, 0xa9, 0xeb, 0x76, 0x60, 0xa2, 0x56, 0xa2, 0x90, 0x32, 0xcd, 0x25, 0x41, 0xb7, 0xc0, 0x9e, 0x13, 0x97, 0xaf }));
Assert.IsTrue(m.Signature.SequenceEqual(new byte[] { 0x00, 0x00, 0x00, 0x07, 0x73, 0x73, 0x68, 0x2d, 0x72, 0x73, 0x61, 0x00, 0x00, 0x01, 0x00, 0x0d, 0x67, 0x83, 0xa1, 0xb8, 0x0c, 0x65, 0xb8, 0xd3, 0x76, 0x5f, 0x5f, 0x05, 0x51, 0x8c, 0xb3, 0x2d, 0x1e, 0x95, 0x67, 0xd6, 0xe2, 0xe4, 0x86, 0x49, 0x11, 0xca, 0x83, 0xab, 0xdb, 0x80, 0x75, 0x4e, 0x89, 0xa7, 0x3d, 0xb6, 0xc2, 0x92, 0xbb, 0x40, 0x00, 0xb9, 0xb3, 0x03, 0x86, 0x19, 0x9d, 0x67, 0x29, 0x2b, 0x5a, 0xc9, 0x0a, 0x6c, 0xa3, 0x21, 0xaf, 0xd8, 0xd4, 0xa7, 0x84, 0x6a, 0xe5, 0x36, 0x3e, 0xa5, 0x58, 0xd6, 0x36, 0x33, 0x12, 0x2e, 0xf9, 0x22, 0x10, 0xff, 0xae, 0x0e, 0xee, 0xfa, 0xdf, 0x1f, 0xf8, 0x70, 0xfe, 0xc0, 0x30, 0x1d, 0x23, 0xbf, 0x99, 0x20, 0x22, 0x18, 0x78, 0xab, 0x5f, 0xd5, 0xfa, 0x5f, 0xf1, 0x18, 0xc2, 0x20, 0xc5, 0x58, 0x90, 0x63, 0x4b, 0x12, 0xf3, 0xa4, 0xe9, 0x20, 0x03, 0x8f, 0x5a, 0x2d, 0x17, 0xbd, 0x75, 0x0a, 0xaf, 0x6d, 0xc5, 0x15, 0x8a, 0x14, 0x74, 0x7f, 0xa0, 0xd2, 0x0f, 0x6f, 0x96, 0xa5, 0x60, 0xb1, 0xb7, 0x65, 0x0f, 0x48, 0x67, 0x5d, 0x32, 0x0a, 0xcb, 0x8e, 0xdf, 0x0c, 0xa9, 0xd5, 0x14, 0x0b, 0x6d, 0xfb, 0x8b, 0xef, 0xa3, 0x79, 0xaf, 0xdb, 0xa3, 0xb4, 0x6d, 0xbb, 0x40, 0x9e, 0xb3, 0x45, 0x04, 0x7f, 0xd1, 0x84, 0xad, 0x90, 0x8b, 0x2d, 0xb6, 0x13, 0xfb, 0x7a, 0xf5, 0xad, 0xbf, 0xa6, 0x74, 0x75, 0xfa, 0x70, 0x59, 0xae, 0x22, 0xbb, 0xfb, 0x09, 0x68, 0xae, 0xe5, 0x26, 0x5c, 0xbd, 0xe0, 0xae, 0x39, 0xbb, 0xaa, 0x59, 0x4c, 0x73, 0x11, 0x01, 0x64, 0x6d, 0xc1, 0x95, 0x1b, 0x93, 0x6b, 0x14, 0x83, 0x4a, 0xdc, 0x16, 0x67, 0x7b, 0x85, 0xd0, 0x89, 0x2e, 0x3c, 0xa1, 0x05, 0x34, 0xf0, 0xd2, 0xb9, 0x3b, 0x83, 0xf4, 0x02, 0xd4, 0x7f, 0x73, 0x76, 0x5d, 0xc2, 0x67, 0xb9, 0xac, 0x8a, 0xd1, 0xab, 0xd4, 0x82 }));
Assert.IsTrue(m.F.Equals(BigInteger.Parse("139283707184174223973094328642546470115773370503206784462562067731214352325418848176518987606406368553205415627101408281035430394244245366884121855956041981785619368311948822371849754297010084387209814408417993188610908497995240761565618964080251146407679074869975343762660867551322434680855150842669738933549", System.Globalization.NumberStyles.None, CultureInfo.CurrentCulture)));
Assert.IsTrue(m.F.SequenceEqual(new byte[] { 0x00, 0xc6, 0x58, 0xb9, 0xa8, 0x11, 0xfd, 0xb6, 0xd6, 0xe9, 0x0c, 0x51, 0x45, 0xac, 0x51, 0x8a, 0x25, 0x6e, 0x1d, 0x9e, 0xbb, 0x7f, 0x98, 0xe3, 0x94, 0xd5, 0xac, 0x97, 0xd6, 0x35, 0x2e, 0xcc, 0x34, 0x85, 0xe2, 0x29, 0x2c, 0xba, 0x45, 0x6b, 0x39, 0xce, 0xd2, 0xae, 0x2e, 0x9a, 0x30, 0x43, 0x45, 0x09, 0xd2, 0xeb, 0x21, 0x46, 0x95, 0xa8, 0xb9, 0xbc, 0xb4, 0x21, 0xcd, 0x65, 0xeb, 0x0f, 0x48, 0x3c, 0x82, 0xdb, 0x52, 0x0e, 0xa5, 0xa8, 0xca, 0x29, 0x2d, 0xf8, 0x54, 0x38, 0xe4, 0x8f, 0x2c, 0x2d, 0x45, 0x2d, 0x2c, 0xf7, 0x1a, 0x41, 0xef, 0xd4, 0xec, 0x0f, 0xa5, 0xa8, 0xa7, 0x64, 0xb3, 0xe8, 0x7b, 0xa1, 0x40, 0x41, 0x69, 0x70, 0x4d, 0x95, 0x91, 0x8b, 0x5f, 0x28, 0xa2, 0xfc, 0xa7, 0x12, 0x2b, 0x94, 0xf0, 0x0a, 0x82, 0x92, 0x65, 0xdf, 0x8a, 0x35, 0xfb, 0xcc, 0xbe, 0xbd, 0x2d }));
}
}
}
@@ -5,13 +5,111 @@ using System.Xml;
namespace Renci.SshNet.Tests.Classes
{
// TODO: Please help with documentation here, as I don't know the details, specially for the methods not documented.
/// <summary>
///
/// </summary>
[TestClass]
public partial class NetConfClientTest : TestBase
public class NetConfClientTest : TestBase
{
private Random _random;
[TestInitialize]
public void SetUp()
{
_random = new Random();
}
[TestMethod]
public void OperationTimeout_Default()
{
var connectionInfo = new PasswordConnectionInfo("host", 22, "admin", "pwd");
var target = new NetConfClient(connectionInfo);
var actual = target.OperationTimeout;
Assert.AreEqual(TimeSpan.FromMilliseconds(-1), actual);
}
[TestMethod]
public void OperationTimeout_InsideLimits()
{
var operationTimeout = TimeSpan.FromMilliseconds(_random.Next(0, int.MaxValue - 1));
var connectionInfo = new PasswordConnectionInfo("host", 22, "admin", "pwd");
var target = new NetConfClient(connectionInfo)
{
OperationTimeout = operationTimeout
};
var actual = target.OperationTimeout;
Assert.AreEqual(operationTimeout, actual);
}
[TestMethod]
public void OperationTimeout_LowerLimit()
{
var operationTimeout = TimeSpan.FromMilliseconds(-1);
var connectionInfo = new PasswordConnectionInfo("host", 22, "admin", "pwd");
var target = new NetConfClient(connectionInfo)
{
OperationTimeout = operationTimeout
};
var actual = target.OperationTimeout;
Assert.AreEqual(operationTimeout, actual);
}
[TestMethod]
public void OperationTimeout_UpperLimit()
{
var operationTimeout = TimeSpan.FromMilliseconds(int.MaxValue);
var connectionInfo = new PasswordConnectionInfo("host", 22, "admin", "pwd");
var target = new NetConfClient(connectionInfo)
{
OperationTimeout = operationTimeout
};
var actual = target.OperationTimeout;
Assert.AreEqual(operationTimeout, actual);
}
[TestMethod]
public void OperationTimeout_LessThanLowerLimit()
{
var operationTimeout = TimeSpan.FromMilliseconds(-2);
var connectionInfo = new PasswordConnectionInfo("host", 22, "admin", "pwd");
var target = new NetConfClient(connectionInfo);
try
{
target.OperationTimeout = operationTimeout;
}
catch (ArgumentOutOfRangeException ex)
{
Assert.IsNull(ex.InnerException);
Assert.AreEqual("The timeout must represent a value between -1 and Int32.MaxValue, inclusive." + Environment.NewLine + "Parameter name: " + ex.ParamName, ex.Message);
Assert.AreEqual("value", ex.ParamName);
}
}
[TestMethod]
public void OperationTimeout_GreaterThanLowerLimit()
{
var operationTimeout = TimeSpan.FromMilliseconds(int.MaxValue).Add(TimeSpan.FromMilliseconds(1));
var connectionInfo = new PasswordConnectionInfo("host", 22, "admin", "pwd");
var target = new NetConfClient(connectionInfo);
try
{
target.OperationTimeout = operationTimeout;
}
catch (ArgumentOutOfRangeException ex)
{
Assert.IsNull(ex.InnerException);
Assert.AreEqual("The timeout must represent a value between -1 and Int32.MaxValue, inclusive." + Environment.NewLine + "Parameter name: " + ex.ParamName, ex.Message);
Assert.AreEqual("value", ex.ParamName);
}
}
/// <summary>
///A test for NetConfClient Constructor
///</summary>
@@ -146,23 +244,6 @@ namespace Renci.SshNet.Tests.Classes
Assert.Inconclusive("Verify the correctness of this test method.");
}
/// <summary>
///A test for OperationTimeout
///</summary>
[TestMethod]
[Ignore] // placeholder for actual test
public void OperationTimeoutTest()
{
ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
NetConfClient target = new NetConfClient(connectionInfo); // TODO: Initialize to an appropriate value
TimeSpan expected = new TimeSpan(); // TODO: Initialize to an appropriate value
TimeSpan actual;
target.OperationTimeout = expected;
actual = target.OperationTimeout;
Assert.AreEqual(expected, actual);
Assert.Inconclusive("Verify the correctness of this test method.");
}
/// <summary>
///A test for ClientCapabilities
///</summary>
@@ -0,0 +1,140 @@
using System;
using System.Reflection;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Renci.SshNet.Common;
using Renci.SshNet.NetConf;
using Renci.SshNet.Security;
namespace Renci.SshNet.Tests.Classes
{
[TestClass]
public class NetConfClientTest_Connect_NetConfSessionConnectFailure
{
private Mock<IServiceFactory> _serviceFactoryMock;
private Mock<ISession> _sessionMock;
private Mock<INetConfSession> _netConfSessionMock;
private ConnectionInfo _connectionInfo;
private ApplicationException _netConfSessionConnectionException;
private NetConfClient _netConfClient;
private ApplicationException _actualException;
[TestInitialize]
public void Setup()
{
Arrange();
Act();
}
private void Arrange()
{
SetupData();
CreateMocks();
SetupMocks();
_netConfClient = new NetConfClient(_connectionInfo, false, _serviceFactoryMock.Object);
}
private void SetupData()
{
_connectionInfo = new ConnectionInfo("host", "user", new NoneAuthenticationMethod("userauth"));
_netConfSessionConnectionException = new ApplicationException();
}
private void CreateMocks()
{
_serviceFactoryMock = new Mock<IServiceFactory>(MockBehavior.Strict);
_sessionMock = new Mock<ISession>(MockBehavior.Strict);
_netConfSessionMock = new Mock<INetConfSession>(MockBehavior.Strict);
}
private void SetupMocks()
{
var sequence = new MockSequence();
_serviceFactoryMock.InSequence(sequence)
.Setup(p => p.CreateSession(_connectionInfo))
.Returns(_sessionMock.Object);
_sessionMock.InSequence(sequence)
.Setup(p => p.Connect());
_serviceFactoryMock.InSequence(sequence)
.Setup(p => p.CreateNetConfSession(_sessionMock.Object, -1))
.Returns(_netConfSessionMock.Object);
_netConfSessionMock.InSequence(sequence)
.Setup(p => p.Connect())
.Throws(_netConfSessionConnectionException);
_netConfSessionMock.InSequence(sequence)
.Setup(p => p.Dispose());
_sessionMock.InSequence(sequence)
.Setup(p => p.Dispose());
}
private void Act()
{
try
{
_netConfClient.Connect();
Assert.Fail();
}
catch (ApplicationException ex)
{
_actualException = ex;
}
}
[TestMethod]
public void ConnectShouldHaveThrownApplicationException()
{
Assert.IsNotNull(_actualException);
Assert.AreSame(_netConfSessionConnectionException, _actualException);
}
[TestMethod]
public void SessionShouldBeNull()
{
Assert.IsNull(_netConfClient.Session);
}
[TestMethod]
public void NetConfSessionShouldBeNull()
{
Assert.IsNull(_netConfClient.NetConfSession);
}
[TestMethod]
public void ErrorOccuredOnSessionShouldNoLongerBeSignaledViaErrorOccurredOnNetConfClient()
{
var errorOccurredSignalCount = 0;
_netConfClient.ErrorOccurred += (sender, args) => Interlocked.Increment(ref errorOccurredSignalCount);
_sessionMock.Raise(p => p.ErrorOccured += null, new ExceptionEventArgs(new Exception()));
Assert.AreEqual(0, errorOccurredSignalCount);
}
[TestMethod]
public void HostKeyReceivedOnSessionShouldNoLongerBeSignaledViaHostKeyReceivedOnSftpClient()
{
var hostKeyReceivedSignalCount = 0;
_netConfClient.HostKeyReceived += (sender, args) => Interlocked.Increment(ref hostKeyReceivedSignalCount);
_sessionMock.Raise(p => p.HostKeyReceived += null, new HostKeyEventArgs(GetKeyHostAlgorithm()));
Assert.AreEqual(0, hostKeyReceivedSignalCount);
}
private static KeyHostAlgorithm GetKeyHostAlgorithm()
{
var executingAssembly = Assembly.GetExecutingAssembly();
using (var s = executingAssembly.GetManifestResourceStream(string.Format("Renci.SshNet.Tests.Data.{0}", "Key.RSA.txt")))
{
var privateKey = new PrivateKeyFile(s);
return (KeyHostAlgorithm)privateKey.HostKey;
}
}
}
}
@@ -319,6 +319,72 @@ namespace Renci.SshNet.Tests.Classes
}
}
[TestMethod]
[Owner("darinkes")]
[TestCategory("PrivateKey")]
public void Test_PrivateKey_ECDSA()
{
using (var stream = GetData("Key.ECDSA.txt"))
{
new PrivateKeyFile(stream);
}
}
[TestMethod]
[Owner("darinkes")]
[TestCategory("PrivateKey")]
public void Test_PrivateKey_ECDSA384()
{
using (var stream = GetData("Key.ECDSA384.txt"))
{
new PrivateKeyFile(stream);
}
}
[TestMethod]
[Owner("darinkes")]
[TestCategory("PrivateKey")]
public void Test_PrivateKey_ECDSA521()
{
using (var stream = GetData("Key.ECDSA521.txt"))
{
new PrivateKeyFile(stream);
}
}
[TestMethod]
[Owner("darinkes")]
[TestCategory("PrivateKey")]
public void Test_PrivateKey_ECDSA_Encrypted()
{
using (var stream = GetData("Key.ECDSA.Encrypted.txt"))
{
new PrivateKeyFile(stream, "12345");
}
}
[TestMethod]
[Owner("darinkes")]
[TestCategory("PrivateKey")]
public void Test_PrivateKey_ECDSA384_Encrypted()
{
using (var stream = GetData("Key.ECDSA384.Encrypted.txt"))
{
new PrivateKeyFile(stream, "12345");
}
}
[TestMethod]
[Owner("darinkes")]
[TestCategory("PrivateKey")]
public void Test_PrivateKey_ECDSA521_Encrypted()
{
using (var stream = GetData("Key.ECDSA521.Encrypted.txt"))
{
new PrivateKeyFile(stream, "12345");
}
}
/// <summary>
///A test for Dispose
///</summary>
@@ -479,6 +545,34 @@ namespace Renci.SshNet.Tests.Classes
}
}
/// <summary>
/// A test for opening an openssh v1 keyfile where there is no passphrase.
///</summary>
[TestMethod()]
[Owner("bhalbright")]
[TestCategory("PrivateKey")]
public void TestOpenSshV1KeyFileNoPassphrase()
{
using (var stream = GetData("Key.OPENSSH.ED25519.txt"))
{
new PrivateKeyFile(stream);
}
}
/// <summary>
/// A test for opening an openssh v1 keyfile where there is a passphrase.
///</summary>
[TestMethod()]
[Owner("bhalbright")]
[TestCategory("PrivateKey")]
public void TestOpenSshV1KeyFileWithPassphrase()
{
using (var stream = GetData("Key.OPENSSH.ED25519.Encrypted.txt"))
{
new PrivateKeyFile(stream, "password");
}
}
private void SaveStreamToFile(Stream stream, string fileName)
{
var buffer = new byte[4000];
@@ -501,4 +595,4 @@ namespace Renci.SshNet.Tests.Classes
return tempFile;
}
}
}
}
@@ -1,109 +0,0 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Renci.SshNet.Common;
using Renci.SshNet.Tests.Properties;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace Renci.SshNet.Tests.Classes
{
/// <summary>
/// Provides SCP client functionality.
/// </summary>
public partial class ScpClientTest
{
[TestMethod]
[TestCategory("Scp")]
[TestCategory("integration")]
public void Test_Scp_File_20_Parallel_Upload_Download()
{
using (var scp = new ScpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
{
scp.Connect();
var uploadFilenames = new string[20];
for (int i = 0; i < uploadFilenames.Length; i++)
{
uploadFilenames[i] = Path.GetTempFileName();
this.CreateTestFile(uploadFilenames[i], 1);
}
Parallel.ForEach(uploadFilenames,
(filename) =>
{
scp.Upload(new FileInfo(filename), Path.GetFileName(filename));
});
Parallel.ForEach(uploadFilenames,
(filename) =>
{
scp.Download(Path.GetFileName(filename), new FileInfo(string.Format("{0}.down", filename)));
});
var result = from file in uploadFilenames
where
CalculateMD5(file) == CalculateMD5(string.Format("{0}.down", file))
select file;
scp.Disconnect();
Assert.IsTrue(result.Count() == uploadFilenames.Length);
}
}
[TestMethod]
[TestCategory("Scp")]
[TestCategory("integration")]
public void Test_Scp_File_Upload_Download_Events()
{
using (var scp = new ScpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
{
scp.Connect();
var uploadFilenames = new string[10];
for (int i = 0; i < uploadFilenames.Length; i++)
{
uploadFilenames[i] = Path.GetTempFileName();
this.CreateTestFile(uploadFilenames[i], 1);
}
var uploadedFiles = uploadFilenames.ToDictionary((filename) => Path.GetFileName(filename), (filename) => 0L);
var downloadedFiles = uploadFilenames.ToDictionary((filename) => string.Format("{0}.down", Path.GetFileName(filename)), (filename) => 0L);
scp.Uploading += delegate(object sender, ScpUploadEventArgs e)
{
uploadedFiles[e.Filename] = e.Uploaded;
};
scp.Downloading += delegate(object sender, ScpDownloadEventArgs e)
{
downloadedFiles[string.Format("{0}.down", e.Filename)] = e.Downloaded;
};
Parallel.ForEach(uploadFilenames,
(filename) =>
{
scp.Upload(new FileInfo(filename), Path.GetFileName(filename));
});
Parallel.ForEach(uploadFilenames,
(filename) =>
{
scp.Download(Path.GetFileName(filename), new FileInfo(string.Format("{0}.down", filename)));
});
var result = from uf in uploadedFiles
from df in downloadedFiles
where
string.Format("{0}.down", uf.Key) == df.Key
&& uf.Value == df.Value
select uf;
scp.Disconnect();
Assert.IsTrue(result.Count() == uploadFilenames.Length && uploadFilenames.Length == uploadedFiles.Count && uploadedFiles.Count == downloadedFiles.Count);
}
}
}
}
@@ -7,6 +7,9 @@ using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
#if FEATURE_TPL
using System.Threading.Tasks;
#endif // FEATURE_TPL
namespace Renci.SshNet.Tests.Classes
{
@@ -536,6 +539,102 @@ namespace Renci.SshNet.Tests.Classes
Assert.Inconclusive("A method that does not return a value cannot be verified.");
}
#if FEATURE_TPL
[TestMethod]
[TestCategory("Scp")]
[TestCategory("integration")]
public void Test_Scp_File_20_Parallel_Upload_Download()
{
using (var scp = new ScpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
{
scp.Connect();
var uploadFilenames = new string[20];
for (int i = 0; i < uploadFilenames.Length; i++)
{
uploadFilenames[i] = Path.GetTempFileName();
this.CreateTestFile(uploadFilenames[i], 1);
}
Parallel.ForEach(uploadFilenames,
(filename) =>
{
scp.Upload(new FileInfo(filename), Path.GetFileName(filename));
});
Parallel.ForEach(uploadFilenames,
(filename) =>
{
scp.Download(Path.GetFileName(filename), new FileInfo(string.Format("{0}.down", filename)));
});
var result = from file in uploadFilenames
where
CalculateMD5(file) == CalculateMD5(string.Format("{0}.down", file))
select file;
scp.Disconnect();
Assert.IsTrue(result.Count() == uploadFilenames.Length);
}
}
[TestMethod]
[TestCategory("Scp")]
[TestCategory("integration")]
public void Test_Scp_File_Upload_Download_Events()
{
using (var scp = new ScpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
{
scp.Connect();
var uploadFilenames = new string[10];
for (int i = 0; i < uploadFilenames.Length; i++)
{
uploadFilenames[i] = Path.GetTempFileName();
this.CreateTestFile(uploadFilenames[i], 1);
}
var uploadedFiles = uploadFilenames.ToDictionary((filename) => Path.GetFileName(filename), (filename) => 0L);
var downloadedFiles = uploadFilenames.ToDictionary((filename) => string.Format("{0}.down", Path.GetFileName(filename)), (filename) => 0L);
scp.Uploading += delegate (object sender, ScpUploadEventArgs e)
{
uploadedFiles[e.Filename] = e.Uploaded;
};
scp.Downloading += delegate (object sender, ScpDownloadEventArgs e)
{
downloadedFiles[string.Format("{0}.down", e.Filename)] = e.Downloaded;
};
Parallel.ForEach(uploadFilenames,
(filename) =>
{
scp.Upload(new FileInfo(filename), Path.GetFileName(filename));
});
Parallel.ForEach(uploadFilenames,
(filename) =>
{
scp.Download(Path.GetFileName(filename), new FileInfo(string.Format("{0}.down", filename)));
});
var result = from uf in uploadedFiles
from df in downloadedFiles
where
string.Format("{0}.down", uf.Key) == df.Key
&& uf.Value == df.Value
select uf;
scp.Disconnect();
Assert.IsTrue(result.Count() == uploadFilenames.Length && uploadFilenames.Length == uploadedFiles.Count && uploadedFiles.Count == downloadedFiles.Count);
}
}
#endif // FEATURE_TPL
protected static string CalculateMD5(string fileName)
{
using (var file = new FileStream(fileName, FileMode.Open))
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
@@ -25,7 +24,7 @@ namespace Renci.SshNet.Tests.Classes
_connectionInfo = new ConnectionInfo("host", 22, "user", new PasswordAuthenticationMethod("user", "pwd"));
_directoryInfo = new DirectoryInfo("source");
_path = "/home/sshnet/" + random.Next().ToString(CultureInfo.InvariantCulture);
_path = "/home/sshnet/" + random.Next().ToString();
_transformedPath = random.Next().ToString();
_uploadingRegister = new List<ScpUploadEventArgs>();
}
@@ -48,7 +47,7 @@ namespace Renci.SshNet.Tests.Classes
.Setup(p => p.Transform(_path))
.Returns(_transformedPath);
_channelSessionMock.InSequence(sequence)
.Setup(p => p.SendExecRequest(string.Format("scp -rt {0}", _transformedPath)))
.Setup(p => p.SendExecRequest(string.Format("scp -r -p -d -t {0}", _transformedPath)))
.Returns(false);
_channelSessionMock.InSequence(sequence).Setup(p => p.Dispose());
_pipeStreamMock.As<IDisposable>().InSequence(sequence).Setup(p => p.Dispose());
@@ -87,7 +86,7 @@ namespace Renci.SshNet.Tests.Classes
[TestMethod]
public void SendExecREquestOnChannelSessionShouldBeInvokedOnce()
{
_channelSessionMock.Verify(p => p.SendExecRequest(string.Format("scp -rt {0}", _transformedPath)), Times.Once);
_channelSessionMock.Verify(p => p.SendExecRequest(string.Format("scp -r -p -d -t {0}", _transformedPath)), Times.Once);
}
[TestMethod]
@@ -13,7 +13,9 @@ namespace Renci.SshNet.Tests.Classes
private ConnectionInfo _connectionInfo;
private ScpClient _scpClient;
private FileInfo _fileInfo;
private string _path;
private string _remoteDirectory;
private string _remoteFile;
private string _remotePath;
private string _transformedPath;
private string _fileName;
private IList<ScpUploadEventArgs> _uploadingRegister;
@@ -36,7 +38,9 @@ namespace Renci.SshNet.Tests.Classes
_fileName = CreateTemporaryFile(new byte[] { 1 });
_connectionInfo = new ConnectionInfo("host", 22, "user", new PasswordAuthenticationMethod("user", "pwd"));
_fileInfo = new FileInfo(_fileName);
_path = "/home/sshnet/" + random.Next();
_remoteDirectory = "/home/sshnet";
_remoteFile = random.Next().ToString();
_remotePath = _remoteDirectory + "/" + _remoteFile;
_transformedPath = random.Next().ToString();
_uploadingRegister = new List<ScpUploadEventArgs>();
}
@@ -56,10 +60,10 @@ namespace Renci.SshNet.Tests.Classes
_sessionMock.InSequence(sequence).Setup(p => p.CreateChannelSession()).Returns(_channelSessionMock.Object);
_channelSessionMock.InSequence(sequence).Setup(p => p.Open());
_remotePathTransformationMock.InSequence(sequence)
.Setup(p => p.Transform(_path))
.Setup(p => p.Transform(_remoteDirectory))
.Returns(_transformedPath);
_channelSessionMock.InSequence(sequence)
.Setup(p => p.SendExecRequest(string.Format("scp -t {0}", _transformedPath)))
.Setup(p => p.SendExecRequest(string.Format("scp -t -d {0}", _transformedPath)))
.Returns(false);
_channelSessionMock.InSequence(sequence).Setup(p => p.Dispose());
_pipeStreamMock.As<IDisposable>().InSequence(sequence).Setup(p => p.Dispose());
@@ -78,7 +82,7 @@ namespace Renci.SshNet.Tests.Classes
{
try
{
_scpClient.Upload(_fileInfo, _path);
_scpClient.Upload(_fileInfo, _remotePath);
Assert.Fail();
}
catch (SshException ex)
@@ -98,7 +102,7 @@ namespace Renci.SshNet.Tests.Classes
[TestMethod]
public void SendExecRequestOnChannelSessionShouldBeInvokedOnce()
{
_channelSessionMock.Verify(p => p.SendExecRequest(string.Format("scp -t {0}", _transformedPath)), Times.Once);
_channelSessionMock.Verify(p => p.SendExecRequest(string.Format("scp -t -d {0}", _transformedPath)), Times.Once);
}
[TestMethod]
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
@@ -16,7 +15,9 @@ namespace Renci.SshNet.Tests.Classes
private ConnectionInfo _connectionInfo;
private ScpClient _scpClient;
private FileInfo _fileInfo;
private string _path;
private string _remoteDirectory;
private string _remoteFile;
private string _remotePath;
private string _transformedPath;
private int _bufferSize;
private byte[] _fileContent;
@@ -44,7 +45,9 @@ namespace Renci.SshNet.Tests.Classes
_fileName = CreateTemporaryFile(_fileContent);
_connectionInfo = new ConnectionInfo("host", 22, "user", new PasswordAuthenticationMethod("user", "pwd"));
_fileInfo = new FileInfo(_fileName);
_path = "/home/sshnet/" + random.Next().ToString(CultureInfo.InvariantCulture);
_remoteDirectory = "/home/sshnet";
_remoteFile = random.Next().ToString();
_remotePath = _remoteDirectory + "/" + _remoteFile;
_transformedPath = random.Next().ToString();
_uploadingRegister = new List<ScpUploadEventArgs>();
}
@@ -64,17 +67,18 @@ namespace Renci.SshNet.Tests.Classes
_sessionMock.InSequence(sequence).Setup(p => p.CreateChannelSession()).Returns(_channelSessionMock.Object);
_channelSessionMock.InSequence(sequence).Setup(p => p.Open());
_remotePathTransformationMock.InSequence(sequence)
.Setup(p => p.Transform(_path))
.Setup(p => p.Transform(_remoteDirectory))
.Returns(_transformedPath);
_channelSessionMock.InSequence(sequence)
.Setup(p => p.SendExecRequest(string.Format("scp -t {0}", _transformedPath)))
.Setup(p => p.SendExecRequest(string.Format("scp -t -d {0}", _transformedPath)))
.Returns(true);
_pipeStreamMock.InSequence(sequence).Setup(p => p.ReadByte()).Returns(0);
_channelSessionMock.InSequence(sequence).Setup(p => p.SendData(It.IsAny<byte[]>()));
_pipeStreamMock.InSequence(sequence).Setup(p => p.ReadByte()).Returns(0);
_channelSessionMock.InSequence(sequence)
.Setup(p => p.SendData(It.Is<byte[]>(b => b.SequenceEqual(CreateData(
string.Format("C0644 {0} {1}\n", _fileInfo.Length, string.Empty))))));
.Setup(p => p.SendData(It.Is<byte[]>(b => b.SequenceEqual(
CreateData(string.Format("C0644 {0} {1}\n", _fileInfo.Length, _remoteFile),
_connectionInfo.Encoding)))));
_pipeStreamMock.InSequence(sequence).Setup(p => p.ReadByte()).Returns(0);
_channelSessionMock.InSequence(sequence)
.Setup(
@@ -104,13 +108,13 @@ namespace Renci.SshNet.Tests.Classes
protected override void Act()
{
_scpClient.Upload(_fileInfo, _path);
_scpClient.Upload(_fileInfo, _remotePath);
}
[TestMethod]
public void SendExecRequestOnChannelSessionShouldBeInvokedOnce()
{
_channelSessionMock.Verify(p => p.SendExecRequest(string.Format("scp -t {0}", _transformedPath)), Times.Once);
_channelSessionMock.Verify(p => p.SendExecRequest(string.Format("scp -t -d {0}", _transformedPath)), Times.Once);
}
[TestMethod]
@@ -143,9 +147,9 @@ namespace Renci.SshNet.Tests.Classes
Assert.AreEqual(_fileSize, uploading.Uploaded);
}
private static IEnumerable<byte> CreateData(string command)
private static IEnumerable<byte> CreateData(string command, Encoding encoding)
{
return Encoding.Default.GetBytes(command);
return encoding.GetBytes(command);
}
private static byte[] CreateContent(int length)
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
@@ -14,7 +13,9 @@ namespace Renci.SshNet.Tests.Classes
private ConnectionInfo _connectionInfo;
private ScpClient _scpClient;
private Stream _source;
private string _path;
private string _remoteDirectory;
private string _remoteFile;
private string _remotePath;
private string _transformedPath;
private IList<ScpUploadEventArgs> _uploadingRegister;
private SshException _actualException;
@@ -34,7 +35,9 @@ namespace Renci.SshNet.Tests.Classes
_connectionInfo = new ConnectionInfo("host", 22, "user", new PasswordAuthenticationMethod("user", "pwd"));
_source = new MemoryStream();
_path = "/home/sshnet/" + random.Next().ToString(CultureInfo.InvariantCulture);
_remoteDirectory = "/home/sshnet";
_remoteFile = random.Next().ToString();
_remotePath = _remoteDirectory + "/" + _remoteFile;
_transformedPath = random.Next().ToString();
_uploadingRegister = new List<ScpUploadEventArgs>();
}
@@ -54,10 +57,10 @@ namespace Renci.SshNet.Tests.Classes
_sessionMock.InSequence(sequence).Setup(p => p.CreateChannelSession()).Returns(_channelSessionMock.Object);
_channelSessionMock.InSequence(sequence).Setup(p => p.Open());
_remotePathTransformationMock.InSequence(sequence)
.Setup(p => p.Transform(_path))
.Setup(p => p.Transform(_remoteDirectory))
.Returns(_transformedPath);
_channelSessionMock.InSequence(sequence)
.Setup(p => p.SendExecRequest(string.Format("scp -t {0}", _transformedPath)))
.Setup(p => p.SendExecRequest(string.Format("scp -t -d {0}", _transformedPath)))
.Returns(false);
_channelSessionMock.InSequence(sequence).Setup(p => p.Dispose());
_pipeStreamMock.As<IDisposable>().InSequence(sequence).Setup(p => p.Dispose());
@@ -76,7 +79,7 @@ namespace Renci.SshNet.Tests.Classes
{
try
{
_scpClient.Upload(_source, _path);
_scpClient.Upload(_source, _remotePath);
Assert.Fail();
}
catch (SshException ex)
@@ -96,7 +99,7 @@ namespace Renci.SshNet.Tests.Classes
[TestMethod]
public void SendExecRequestOnChannelSessionShouldBeInvokedOnce()
{
_channelSessionMock.Verify(p => p.SendExecRequest(string.Format("scp -t {0}", _transformedPath)), Times.Once);
_channelSessionMock.Verify(p => p.SendExecRequest(string.Format("scp -t -d {0}", _transformedPath)), Times.Once);
}
[TestMethod]

Some files were not shown because too many files have changed in this diff Show More