Auth Creds with one parameter

This commit is contained in:
rodkings
2015-04-26 11:52:18 -06:00
parent 535941cfe8
commit fe555f4fff
5 changed files with 12 additions and 11 deletions

View File

@@ -11,13 +11,13 @@ namespace Untappd.Net.UnitTests.Client
[ExpectedException(typeof(ArgumentNullException))]
public void ExpectException()
{
var t = new AuthenticatedUntappdCredentials(null, "d", "d");
var t = new AuthenticatedUntappdCredentials(null);
}
[Test]
public void ExpectValid()
{
var token = "awesome";
var t = new AuthenticatedUntappdCredentials(token, "d", "d");
var t = new AuthenticatedUntappdCredentials(token);
Assert.AreEqual(token, "awesome");
token = "newString";
//Make sure the reference is not copied over

View File

@@ -29,10 +29,7 @@ namespace Untappd.Net.UnitTests
[Ignore]
public void GetActualJsonRequest()
{
var credentials = new AuthenticatedUntappdCredentials(
"",
"",
"");
var credentials = new AuthenticatedUntappdCredentials("");
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters.Add("q", "wild rose");

View File

@@ -11,8 +11,7 @@ namespace Untappd.Net.Client
/// <param name="accessToken"></param>
/// <param name="clientId"></param>
/// <param name="clientSecret"></param>
public AuthenticatedUntappdCredentials(string accessToken, string clientId, string clientSecret)
:base(clientId, clientSecret)
public AuthenticatedUntappdCredentials(string accessToken)
{
if (string.IsNullOrWhiteSpace(accessToken))
{

View File

@@ -7,6 +7,10 @@ namespace Untappd.Net.Client
public string ClientId { get; private set; }
public string ClientSecret { get; private set; }
protected UntappdCredentials()
{
}
/// <summary>
/// UnAuthenticated request. Pass your API id and secret
/// </summary>

View File

@@ -28,11 +28,12 @@ namespace Untappd.Net
{
case JsonToken.StartObject:
var instance = (T)serializer.Deserialize(reader, typeof(T));
retval = instance;
retval = instance;
break;
case JsonToken.StartArray:
reader.Read();
retval = new T();
reader.Read();
retval = new T();
break;
}
return retval;