add more coverage

This commit is contained in:
Tommy Parnell
2015-06-19 22:45:40 -05:00
parent 86d0fb514e
commit b4628da36b
2 changed files with 10 additions and 1 deletions

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"));

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