Merge pull request #139 from octokit/methods-be-missing

Those naughty MethodMissingExceptions
This commit is contained in:
Phil Haack
2013-10-31 16:19:59 -07:00
15 changed files with 33 additions and 149 deletions
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
namespace Octokit.Reactive
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Reactive.Threading.Tasks;
namespace Octokit.Reactive
+2 -2
View File
@@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<IntermediateOutputPath>obj\Debug\Net40</IntermediateOutputPath>
<OutputPath>bin\Debug\Net40</OutputPath>
<OutputPath>bin\Debug\Net45\</OutputPath>
<DefineConstants>DEBUG;TRACE;CODE_ANALYSIS;NET_45</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -31,7 +31,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<IntermediateOutputPath>obj\Release\Net40</IntermediateOutputPath>
<OutputPath>bin\Release\Net40</OutputPath>
<OutputPath>bin\Release\Net45\</OutputPath>
<DefineConstants>TRACE;NET_45</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -24,7 +24,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<OutputPath>bin\Release\Net45\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
+3 -3
View File
@@ -16,7 +16,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<OutputPath>bin\Debug\NetCore45\</OutputPath>
<DefineConstants>TRACE;DEBUG;NETFX_CORE;CODE_ANALYSIS;SIMPLE_JSON_OBJARRAYINTERNAL;SIMPLE_JSON_INTERNAL;NET_45</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -24,7 +24,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<OutputPath>bin\Release\NetCore45\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;CODE_ANALYSIS;SIMPLE_JSON_OBJARRAYINTERNAL;SIMPLE_JSON_INTERNAL;NET_45</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -109,7 +109,7 @@
<ItemGroup>
<ProjectReference Include="..\Octokit\Octokit-NetCore45.csproj">
<Project>{c8bc13b6-3fa3-4716-827d-e7706f976fe1}</Project>
<Name>OctokitRT</Name>
<Name>Octokit-NetCore45</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+2 -2
View File
@@ -16,7 +16,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<OutputPath>bin\Debug\Net45\</OutputPath>
<DefineConstants>TRACE;DEBUG;NET_45</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -24,7 +24,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<OutputPath>bin\Release\Net45\</OutputPath>
<DefineConstants>TRACE;NET_45</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -26,7 +26,8 @@ namespace Octokit.Tests.Reactive
var gitHubClient = new GitHubClient(connection);
var client = new ObservableRepositoriesClient(gitHubClient);
var observable = client.Get("stark", "ned");
connection.Received(0).GetAsync<Repository>(Args.Uri);
connection.Received(1).GetAsync<Repository>(Args.Uri, null, null);
var result = await observable;
connection.Received(1).GetAsync<Repository>(Args.Uri, null, null);
+4 -4
View File
@@ -14,11 +14,11 @@
</Target>
<Target Name="RunUnitTests" DependsOnTargets="Build">
<xunit Assembly=".\Octokit.Tests\bin\$(Configuration)\Octokit.Tests.dll" Xml="Octokit.Tests.results.xml" />
<xunit Assembly=".\Octokit.Tests\bin\$(Configuration)\Net45\Octokit.Tests.dll" Xml="Octokit.Tests.results.xml" />
</Target>
<Target Name="RunRTUnitTests" DependsOnTargets="Build">
<xunit Assembly=".\Octokit.Tests\bin\$(Configuration)\OctokitRT.Tests.dll" Xml="OctokitRT.Tests.results.xml" />
<Target Name="RunNetCoreUnitTests" DependsOnTargets="Build">
<xunit Assembly=".\Octokit.Tests\bin\$(Configuration)\NetCore45\Octokit.Tests-NetCore45.dll" Xml="OctokitRT.Tests.results.xml" />
</Target>
<Target Name="RunIntegrationTests" DependsOnTargets="Build; DoNotSkipIntegrationTests; SkipIntegrationTests" />
@@ -31,5 +31,5 @@
<Warning Text ="The integration tests were skipped because the OCTOKIT_GITHUBUSERNAME and OCTOKIT_GITHUBUSERNAME environment variables are not set. Please configure these environment variables for a GitHub test account (DO NOT USE A &quot;REAL&quot; ACCOUNT)." />
</Target>
<Target Name="FullBuild" DependsOnTargets="RunUnitTests; RunRTUnitTests; RunIntegrationTests" />
<Target Name="FullBuild" DependsOnTargets="RunUnitTests; RunNetCoreUnitTests; RunIntegrationTests" />
</Project>
+1 -3
View File
@@ -1,6 +1,4 @@
#if NETFX_CORE
using System.Collections.Generic;
#endif
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Octokit
+1 -3
View File
@@ -1,6 +1,4 @@
#if NETFX_CORE
using System.Collections.Generic;
#endif
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Octokit
-114
View File
@@ -1,114 +0,0 @@
// ----------------------------------------------------
// THIS WHOLE File CAN GO AWAY WHEN WE TARGET 4.5 ONLY
// ----------------------------------------------------
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
namespace Octokit
{
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
public interface IReadOnlyDictionary<TKey, TValue> : IReadOnlyCollection<KeyValuePair<TKey, TValue>>
{
bool ContainsKey(TKey key);
bool TryGetValue(TKey key, out TValue value);
TValue this[TKey key] { get; }
IEnumerable<TKey> Keys { get; }
IEnumerable<TValue> Values { get; }
}
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
public interface IReadOnlyList<out TItem> : IReadOnlyCollection<TItem>
{
TItem this[int index] { get; }
}
public interface IReadOnlyCollection<out T> : IEnumerable<T>
{
int Count { get; }
}
public class ReadOnlyCollection<TItem> : IReadOnlyList<TItem>
{
readonly List<TItem> _source;
public ReadOnlyCollection(IList<TItem> source)
{
_source = new List<TItem>(source);
}
public IEnumerator<TItem> GetEnumerator()
{
return _source.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public int Count
{
get { return _source.Count; }
}
public TItem this[int index]
{
get { return _source[index]; }
}
}
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")]
[SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")]
public class ReadOnlyDictionary<TKey, TValue> : IReadOnlyDictionary<TKey, TValue>
{
readonly IDictionary<TKey, TValue> _source;
public ReadOnlyDictionary(IDictionary<TKey, TValue> source)
{
_source = new Dictionary<TKey, TValue>(source);
}
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
{
return _source.GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
public int Count
{
get { return _source.Count; }
}
public bool ContainsKey(TKey key)
{
return _source.ContainsKey(key);
}
public bool TryGetValue(TKey key, out TValue value)
{
return _source.TryGetValue(key, out value);
}
public TValue this[TKey key]
{
get { return _source[key]; }
}
public IEnumerable<TKey> Keys
{
get { return _source.Keys; }
}
public IEnumerable<TValue> Values
{
get { return _source.Values; }
}
}
}
+2 -2
View File
@@ -29,7 +29,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<IntermediateOutputPath>obj\Release\NetCore45</IntermediateOutputPath>
<OutputPath>bin\Release\NetCore45</OutputPath>
<OutputPath>bin\Release\NetCore45\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;CODE_ANALYSIS;SIMPLE_JSON_OBJARRAYINTERNAL;SIMPLE_JSON_INTERNAL;NET_45</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -180,4 +180,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
+5 -6
View File
@@ -17,8 +17,8 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<IntermediateOutputPath>obj\Debug\Net40</IntermediateOutputPath>
<OutputPath>bin\Debug\Net40</OutputPath>
<IntermediateOutputPath>obj\Debug\Net45</IntermediateOutputPath>
<OutputPath>bin\Debug\Net45</OutputPath>
<DefineConstants>TRACE;DEBUG;CODE_ANALYSIS;CODE_ANALYSIS;SIMPLE_JSON_OBJARRAYINTERNAL;SIMPLE_JSON_INTERNAL;NET_45</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -31,8 +31,8 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<IntermediateOutputPath>obj\Release\Net40</IntermediateOutputPath>
<OutputPath>bin\Release\Net40</OutputPath>
<IntermediateOutputPath>obj\Release\Net45</IntermediateOutputPath>
<OutputPath>bin\Release\Net45\</OutputPath>
<DefineConstants>TRACE;CODE_ANALYSIS;CODE_ANALYSIS;SIMPLE_JSON_OBJARRAYINTERNAL;SIMPLE_JSON_INTERNAL;NET_45</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
@@ -117,7 +117,6 @@
<Compile Include="Exceptions\LoginAttemptsExceededException.cs" />
<Compile Include="Exceptions\RateLimitExceededException.cs" />
<Compile Include="Helpers\CollectionExtensions.cs" />
<Compile Include="Helpers\Net45CompatibilityShim.cs" />
<Compile Include="Helpers\UriExtensions.cs" />
<Compile Include="Http\ApiConnection.cs" />
<Compile Include="Http\IApiConnection.cs" />
@@ -211,4 +210,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>
+2 -2
View File
@@ -14,8 +14,8 @@ if not exist packaging\octokit\lib\netcore45 mkdir packaging\octokit\lib\netcore
copy LICENSE.txt packaging\octokit\
copy README.md packaging\octokit\
copy Octokit\bin\Release\Octokit.dll packaging\octokit\lib\net45\
copy Octokit\bin\WinRT\Release\OctokitRT.dll packaging\octokit\lib\netcore45\
copy Octokit\bin\%config%\Net45\Octokit.dll packaging\octokit\lib\net45\
copy Octokit\bin\%config%\NetCore45\Octokit.dll packaging\octokit\lib\netcore45\
tools\nuget\nuget.exe pack "octokit.nuspec" -BasePath packaging\octokit -Output packaging
+6 -6
View File
@@ -84,8 +84,8 @@ if ($LastExitCode -ne 0) {
Die-WithOutput $exitCode $output
}
function Run-XUnit([string]$project, [int]$timeoutDuration, [string]$projectFolder = $project) {
$dll = "$projectFolder\bin\Release\$project.dll"
function Run-XUnit([string]$platform, [string]$project, [int]$timeoutDuration, [string]$projectFolder = $project) {
$dll = "$projectFolder\bin\Release\$platform\$project.dll"
$xunitDirectory = Join-Path $rootDirectory tools\xunit
$consoleRunner = Join-Path $xunitDirectory xunit.console.clr4.x86.exe
@@ -102,7 +102,7 @@ function Run-XUnit([string]$project, [int]$timeoutDuration, [string]$projectFold
$exitCode = 0
Write-Output "Running Octokit.Tests..."
$result = Run-XUnit Octokit.Tests 120
$result = Run-XUnit Net45 Octokit.Tests 120
if ($result.ExitCode -eq 0) {
# Print out the test result summary.
Write-Output $result.Output[-1]
@@ -112,8 +112,8 @@ if ($result.ExitCode -eq 0) {
}
Write-Output ""
Write-Output "Running OctokitRT.Tests..."
$result = Run-XUnit OctokitRT.Tests 120 Octokit.Tests
Write-Output "Running Octokit.Tests-NetCore45..."
$result = Run-XUnit NetCore45 Octokit.Tests-NetCore45 120 Octokit.Tests
if ($result.ExitCode -eq 0) {
# Print out the test result summary.
Write-Output $result.Output[-1]
@@ -124,7 +124,7 @@ if ($result.ExitCode -eq 0) {
Write-Output ""
Write-Output "Running Octokit.Tests.Integration..."
$result = Run-XUnit Octokit.Tests.Integration 180
$result = Run-XUnit Net45 Octokit.Tests.Integration 180
if ($result.ExitCode -eq 0) {
# Print out the test result summary.
Write-Output $result.Output[-1]