Fix some tests

Update all projects to generate xml documentation file
Cross project fixes to make it compilable for all projects
This commit is contained in:
olegkap_cp
2013-01-27 01:13:53 +00:00
parent d31b4c76e1
commit fd428dd617
12 changed files with 54 additions and 11 deletions
@@ -78,5 +78,15 @@ namespace Renci.SshNet
value.Length = 0;
value.Capacity = 16;
}
internal static bool CanRead(this Socket socket)
{
return socket.Connected && socket.Poll(-1, SelectMode.SelectRead) && socket.Available > 0;
}
internal static bool CanWrite(this Socket socket)
{
return socket.Connected && socket.Poll(-1, SelectMode.SelectWrite);
}
}
}
@@ -66,5 +66,16 @@ namespace Renci.SshNet.Common
algorithm.Clear();
}
internal static bool CanRead(this Socket socket)
{
return socket.Connected;
}
internal static bool CanWrite(this Socket socket)
{
return socket.Connected;
}
}
}
@@ -38,6 +38,7 @@
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>Bin\Debug\Renci.SshNet.Silverlight.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -812,7 +813,7 @@
<FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}">
<SilverlightProjectProperties />
</FlavorProperties>
<UserProperties ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" ProjectLinkReference="2f5f8c90-0bd1-424f-997c-7bc6280919d1" />
<UserProperties ProjectLinkReference="2f5f8c90-0bd1-424f-997c-7bc6280919d1" ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" />
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
@@ -40,6 +40,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<DocumentationFile>Bin\Debug\Renci.SshNet.Silverlight.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -141,6 +142,9 @@
<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>
@@ -804,7 +808,6 @@
<Compile Include="..\Renci.SshNet\SubsystemSession.cs">
<Link>SubsystemSession.cs</Link>
</Compile>
<Compile Include="Common\Extensions.SilverlightShared.cs" />
<Compile Include="ForwardedPortLocal.SilverlightShared.cs" />
<Compile Include="ForwardedPortRemote.SilverlightShared.cs" />
<Compile Include="KeyboardInteractiveAuthenticationMethod.SilverlightShared.cs" />
@@ -822,7 +825,7 @@
<FlavorProperties GUID="{A1591282-1198-4647-A2B1-27E5FF5F6F3B}">
<SilverlightProjectProperties />
</FlavorProperties>
<UserProperties ProjectLinkReference="2f5f8c90-0bd1-424f-997c-7bc6280919d1" ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" />
<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.
@@ -22,7 +22,7 @@ namespace Renci.SshNet.Tests.Classes.Messages.Transport
var output = m.GetBytes();
// Skip first 17 bytes since 16 bytes are randomly generated
Assert.IsTrue(input.SequenceEqual(output));
Assert.IsTrue(input.SequenceEqual(output.Skip(17)));
}
}
}
@@ -41,12 +41,14 @@ namespace Renci.SshNet.Tests.Classes
var host = Resources.HOST;
var username = Resources.USERNAME;
var password = Resources.PASSWORD;
var hostKeyValidated = false;
#region Example SshClient Connect HostKeyReceived
using (var client = new SshClient(host, username, password))
{
client.HostKeyReceived += delegate(object sender, HostKeyEventArgs e)
{
hostKeyValidated = true;
if (e.FingerPrint.SequenceEqual(new byte[] { 0x00, 0x01, 0x02, 0x03 }))
{
e.CanTrust = true;
@@ -61,7 +63,8 @@ namespace Renci.SshNet.Tests.Classes
client.Disconnect();
}
#endregion
Assert.Inconclusive();
Assert.IsTrue(hostKeyValidated);
}
[TestMethod]
@@ -94,6 +97,7 @@ namespace Renci.SshNet.Tests.Classes
var host = Resources.HOST;
var username = Resources.USERNAME;
var password = Resources.PASSWORD;
var exceptionOccured = false;
#region Example SshClient Connect ErrorOccurred
using (var client = new SshClient(host, username, password))
@@ -101,6 +105,7 @@ namespace Renci.SshNet.Tests.Classes
client.ErrorOccurred += delegate(object sender, ExceptionEventArgs e)
{
Console.WriteLine("Error occured: " + e.Exception.ToString());
exceptionOccured = true;
};
client.Connect();
@@ -108,7 +113,7 @@ namespace Renci.SshNet.Tests.Classes
client.Disconnect();
}
#endregion
Assert.Inconclusive();
Assert.IsTrue(exceptionOccured);
}
[TestMethod]
@@ -29,6 +29,7 @@
<NoConfig>true</NoConfig>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>Bin\Debug\Renci.SshNet.WindowsPhone.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -812,7 +813,7 @@
<Import Project="$(MSBuildExtensionsPath)\Microsoft\Silverlight for Phone\$(TargetFrameworkVersion)\Microsoft.Silverlight.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
<UserProperties ProjectLinkReference="2f5f8c90-0bd1-424f-997c-7bc6280919d1" ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" />
<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.
@@ -33,6 +33,7 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<DocumentationFile>Bin\Debug\Renci.SshNet.WindowsPhone.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -855,7 +856,7 @@
<Import Project="$(MSBuildExtensionsPath)\Microsoft\$(TargetFrameworkIdentifier)\$(TargetFrameworkVersion)\Microsoft.$(TargetFrameworkIdentifier).CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
<UserProperties ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" ProjectLinkReference="2f5f8c90-0bd1-424f-997c-7bc6280919d1" />
<UserProperties ProjectLinkReference="2f5f8c90-0bd1-424f-997c-7bc6280919d1" ProjectLinkerExcludeFilter="\\?desktop(\\.*)?$;\\?silverlight(\\.*)?$;\.desktop;\.silverlight;\.xaml;^service references(\\.*)?$;\.clientconfig;^web references(\\.*)?$" />
</VisualStudio>
</ProjectExtensions>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
@@ -77,7 +77,7 @@ namespace Renci.SshNet.Channels
{
var buffer = new byte[this.PacketSize - 9];
while (this._socket != null && this._socket.Connected && this._socket.Poll(1, SelectMode.SelectRead) && this._socket.Available > 0)
while (this._socket != null && this._socket.CanRead())
{
try
{
@@ -71,7 +71,7 @@ namespace Renci.SshNet.Channels
}
// Start reading data from the port and send to channel
while (this._socket != null && this._socket.Connected && this._socket.Poll(1, SelectMode.SelectRead) && this._socket.Available > 0)
while (this._socket != null && this._socket.CanRead())
{
try
{
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
namespace Renci.SshNet
@@ -21,5 +22,15 @@ namespace Renci.SshNet
{
return string.IsNullOrWhiteSpace(value);
}
internal static bool CanRead(this Socket socket)
{
return socket.Connected && socket.Poll(-1, SelectMode.SelectRead) && socket.Available > 0;
}
internal static bool CanWrite(this Socket socket)
{
return socket.Connected && socket.Poll(-1, SelectMode.SelectWrite);
}
}
}
+1 -1
View File
@@ -656,7 +656,7 @@ namespace Renci.SshNet
/// <param name="message">The message.</param>
internal void SendMessage(Message message)
{
if (this._socket == null || !this._socket.Connected && !this._socket.Poll(-1, SelectMode.SelectWrite))
if (this._socket == null || !this._socket.CanWrite())
throw new SshConnectionException("Client not connected.");
if (this._keyExchangeInProgress && !(message is IKeyExchangedAllowed))