Merge pull request #46 from tparnell8/master

Releasing new code
This commit is contained in:
Tommy Parnell
2015-07-15 18:33:43 -04:00
13 changed files with 7975 additions and 1195 deletions

View File

@@ -7,4 +7,4 @@ sudo: false
script:
- gem install bundle
- bundle
- rake preflight
- bundle exec rake preflight

View File

@@ -4,6 +4,8 @@
**Master Circle-CI (Linux):** [![Circle CI](https://circleci.com/gh/tparnell8/Untappd.Net/tree/master.svg?style=svg)](https://circleci.com/gh/tparnell8/Untappd.Net/tree/master)
**Master CodeShip (Linux):**[ ![Codeship Status for tparnell8/Untappd.Net](https://codeship.com/projects/aa00c9e0-f94b-0132-799e-3a92bb520805/status?branch=master)](https://codeship.com/projects/86796)
**Release:**[![Build status](https://ci.appveyor.com/api/projects/status/e21297waldfrso3p/branch/Release?svg=true)](https://ci.appveyor.com/project/tparnell8/untappd-net/branch/Release)
**Code Coverage:** [![Coverage Status](https://coveralls.io/repos/tparnell8/Untappd.Net/badge.svg?branch=master)](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.

View File

@@ -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

View File

@@ -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

View File

@@ -3,4 +3,4 @@ dependencies:
- sudo apt-get update; sudo apt-get install mono-devel
test:
override:
- rake preflight
- bundle exec rake preflight

View File

@@ -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);
});
}
}
}

View File

@@ -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

View File

@@ -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" />

View File

@@ -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

View File

@@ -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

View File

@@ -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; }

View File

@@ -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