@@ -7,4 +7,4 @@ sudo: false
|
||||
script:
|
||||
- gem install bundle
|
||||
- bundle
|
||||
- rake preflight
|
||||
- bundle exec rake preflight
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
**Master Circle-CI (Linux):** [](https://circleci.com/gh/tparnell8/Untappd.Net/tree/master)
|
||||
|
||||
**Master CodeShip (Linux):**[ ](https://codeship.com/projects/86796)
|
||||
|
||||
**Release:**[](https://ci.appveyor.com/project/tparnell8/untappd-net/branch/Release)
|
||||
|
||||
**Code Coverage:** [](https://coveralls.io/r/tparnell8/Untappd.Net?branch=master)
|
||||
@@ -25,6 +27,10 @@ If you wish to build via command line install ruby, and ruby gems. Open up a con
|
||||
* `bundle`
|
||||
* `rake preflight`
|
||||
|
||||
### Linux Boxes
|
||||
|
||||
If you are on a linux box, please make sure you have `mono` and `mono-devel` in your path. Easiest way to install on ubuntu is to run `sudo apt-get install mono-complete`
|
||||
|
||||
## My PR is broken, it works in VS!
|
||||
|
||||
if your pull request is broken either one of two things is happening.
|
||||
|
||||
15
Rakefile
15
Rakefile
@@ -1,4 +1,3 @@
|
||||
require 'bundler/setup'
|
||||
require 'rake/clean'
|
||||
require 'albacore'
|
||||
require 'open-uri'
|
||||
@@ -21,11 +20,23 @@ task :build => [:compile]
|
||||
|
||||
desc 'Run the tests'
|
||||
task :test => [:nunit]
|
||||
desc 'run Static analysis linters'
|
||||
task :lint => [:build, :cs_lint]
|
||||
|
||||
desc 'Retrieve, Build, Test'
|
||||
task :preflight => [:retrieve, :build, :test, :cs_lint]
|
||||
task :preflight => [:clean, :retrieve, :build, :test, :lint]
|
||||
|
||||
desc 'cleans up artifacts'
|
||||
task :clean do
|
||||
puts 'cleaning artifacts from directory'
|
||||
FileUtils.rm_rf("output")
|
||||
FileUtils.rm_rf("packages")
|
||||
FileUtils.rm_rf("tools")
|
||||
FileUtils.rm_rf(Dir.glob("src/**/*.dll"))
|
||||
FileUtils.rm_rf(Dir.glob("src/**/*.pdb"))
|
||||
FileUtils.rm_rf(Dir.glob("src/**/*.mdb"))
|
||||
|
||||
end
|
||||
|
||||
build :compile => ['tools:nuget_fetch'] do |b|
|
||||
b.prop 'Configuration', Configuration
|
||||
|
||||
@@ -7,10 +7,17 @@ namespace :tools do
|
||||
if !FileTest.exist?("#{NUGET}/nuget.exe")
|
||||
puts 'Downloading nuget from nuget.org'
|
||||
|
||||
begin
|
||||
FileUtils.mkdir_p("#{NUGET}")
|
||||
File.open("#{NUGET}/nuget.exe", "wb") do |file|
|
||||
file.write open('https://nuget.org/nuget.exe').read
|
||||
end
|
||||
rescue
|
||||
FileUtils.rm_rf("#{NUGET}/nuget.exe")
|
||||
File.open("#{NUGET}/nuget.exe", "wb") do |file|
|
||||
file.write open('http://nuget.org/nuget.exe').read
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -27,7 +34,7 @@ namespace :tools do
|
||||
end
|
||||
end
|
||||
|
||||
# Make sure we get solution-level deps
|
||||
# Make sure we get solution-level deps
|
||||
sh "#{CMD_PREFIX} #{NUGET}/nuget.exe i .nuget/packages.config -o packages"
|
||||
|
||||
FileList["src/**/packages.config"].each { |filepath|
|
||||
|
||||
@@ -3,4 +3,4 @@ dependencies:
|
||||
- sudo apt-get update; sudo apt-get install mono-devel
|
||||
test:
|
||||
override:
|
||||
- rake preflight
|
||||
- bundle exec rake preflight
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using Untappd.Net.Exception;
|
||||
using Moq;
|
||||
using RestSharp;
|
||||
|
||||
|
||||
namespace Untappd.Net.UnitTests.Exception
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestHttpErrorException
|
||||
{
|
||||
[Test]
|
||||
public void ConfirmNullExceptions()
|
||||
{
|
||||
var mockRequest = new Mock<IRestRequest>();
|
||||
var mockResponse = new Mock<IRestResponse>();
|
||||
|
||||
Assert.Throws<ArgumentNullException>(()=>{
|
||||
var t = new HttpErrorException(mockRequest.Object, null);
|
||||
Console.WriteLine(t);
|
||||
|
||||
});
|
||||
Assert.Throws<ArgumentNullException>(()=>{
|
||||
var t = new HttpErrorException(null, mockResponse.Object);
|
||||
Console.WriteLine(t);
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ using Untappd.Net.Authentication;
|
||||
using Untappd.Net.Request;
|
||||
using Untappd.Net.Responses.Actions;
|
||||
using Untappd.Net.Responses.BeerInfo;
|
||||
using Untappd.Net.Exception;
|
||||
|
||||
namespace Untappd.Net.UnitTests.Request
|
||||
{
|
||||
@@ -67,6 +68,14 @@ namespace Untappd.Net.UnitTests.Request
|
||||
{"access_token", "PostaccessToken"}
|
||||
}));
|
||||
var checkin = new CheckIn("-5", "EST", 1044097) { Shout = "Awesome Brew", Rating = 4 };
|
||||
repository.FailFast = true;
|
||||
repository.OnExceptionThrown += (sender, e) =>
|
||||
{
|
||||
Assert.IsNotNull(sender);
|
||||
Assert.IsNotNull(e);
|
||||
};
|
||||
Assert.Throws<HttpErrorException>(()=>repository.Post(mockAuthCreds.Object, checkin));
|
||||
repository.FailFast = false;
|
||||
repository.Post(mockAuthCreds.Object, checkin);
|
||||
request.Verify(a => a.AddParameter("access_token", "PostaccessToken"));
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -78,6 +78,7 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Request\TestRepository.cs" />
|
||||
<Compile Include="Responses\TestResponseEndpoints.cs" />
|
||||
<Compile Include="Exception\TestHttpErrorException.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Responses\Json\ActivityFeed.json" />
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Untappd.Net.Request
|
||||
{
|
||||
internal IRestClient Client;
|
||||
internal IRestRequest Request;
|
||||
bool FailFast { get; set; }
|
||||
public bool FailFast { get; set; }
|
||||
/// <summary>
|
||||
/// Event to listen to when failFast is set to false
|
||||
/// This allows you to capture the excpetion, before its swallowed
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace Untappd.Net.Responses.Feeds.UserActivityFeed
|
||||
{
|
||||
|
||||
[JsonProperty("facebook")]
|
||||
public int Facebook { get; set; }
|
||||
public string Facebook { get; set; }
|
||||
}
|
||||
|
||||
public class User
|
||||
|
||||
@@ -162,6 +162,12 @@ namespace Untappd.Net.Responses.UserBadges
|
||||
[JsonProperty("is_level")]
|
||||
public bool IsLevel { get; set; }
|
||||
|
||||
[JsonProperty("badge_type")]
|
||||
public string BadgeType { get; set; }
|
||||
|
||||
[JsonProperty("has_badge")]
|
||||
public bool HasBadge { get; set; }
|
||||
|
||||
[JsonProperty("category_id")]
|
||||
public int CategoryId { get; set; }
|
||||
|
||||
@@ -175,7 +181,7 @@ namespace Untappd.Net.Responses.UserBadges
|
||||
public Levels Levels { get; set; }
|
||||
|
||||
[JsonProperty("badge_pack")]
|
||||
public int BadgePack { get; set; }
|
||||
public bool BadgePack { get; set; }
|
||||
|
||||
[JsonProperty("badge_pack_name")]
|
||||
public bool BadgePackName { get; set; }
|
||||
|
||||
@@ -204,7 +204,10 @@ namespace Untappd.Net.Responses.UserInfo
|
||||
{
|
||||
|
||||
[JsonProperty("facebook")]
|
||||
public int Facebook { get; set; }
|
||||
public string Facebook { get; set; }
|
||||
|
||||
[JsonProperty("twitter")]
|
||||
public string Twitter { get; set; }
|
||||
}
|
||||
|
||||
public class User2
|
||||
@@ -964,6 +967,9 @@ namespace Untappd.Net.Responses.UserInfo
|
||||
|
||||
[JsonProperty("facebook")]
|
||||
public int Facebook { get; set; }
|
||||
|
||||
[JsonProperty("twitter")]
|
||||
public string Twitter { get; set; }
|
||||
}
|
||||
|
||||
public class Badge
|
||||
|
||||
Reference in New Issue
Block a user