Permalink
Browse files

* FacebookOAuthResult.Expires (issue # 5850)

  • Loading branch information...
1 parent bac00a8 commit 2b9166ecff75973ecbe191103b517323158827a4 @prabirshrestha committed Mar 25, 2011
@@ -26,14 +26,14 @@ public void TheAccessTokenOfResultIsEqualToTheValuePassedInTheAccessTokenQueryst
}
[Fact]
- public void TheExpiresInOfResultIsEqualToTheValuePassedInTheExpiresInQuerystring()
+ public void IfExpiresIs0ThenTheResultOfExpiresIsMaxDateTime()
{
var url = "http://www.facebook.com/connect/login_success.html#access_token=123|654aaaee068db-100001327642026|sd&expires_in=0";
var result = FacebookOAuthResult.Parse(url);
- var expiresIn = DateTimeConvertor.ToUnixTime(result.Expires);
- Assert.Equal(0, expiresIn);
+ var expiresIn = result.Expires;
+ Assert.Equal(System.DateTime.MaxValue, expiresIn);
}
[Fact]
@@ -91,7 +91,7 @@ internal FacebookOAuthResult(IDictionary<string, object> parameters)
if (parameters.ContainsKey("expires_in"))
{
var expiresIn = Convert.ToDouble(parameters["expires_in"]);
- _expires = DateTimeConvertor.FromUnixTime(expiresIn);
+ _expires = expiresIn == 0 ? DateTime.MaxValue : DateTime.UtcNow.AddSeconds(expiresIn);
}
}

0 comments on commit 2b9166e

Please sign in to comment.