示例#1
0
    public void APITestVerifyAccessTokenOk()
    {
        var json   = @"
        {
            ""client_id"": ""12345678"",
            ""expires_in"": 12345,
            ""scope"": ""profile openid""
        }
        ";
        var called = false;

        LineAPI.VerifyAccessToken(result => {
            Assert.True(result.IsSuccess);
            result.MatchOk(value => {
                called = true;
                Assert.AreEqual(value.ChannelId, "12345678");
                Assert.AreEqual(12345, value.ExpiresIn);
                Assert.AreEqual(value.Scope, "profile openid");
            });
        });

        var identifier = LineAPI.actions.Keys.ToList()[0];

        LineAPI._OnApiOk(CallbackPayload.WrapValue(identifier, json));
        Assert.True(called);
        Assert.IsEmpty(LineAPI.actions);
    }
 public void VerifyToken()
 {
     LineAPI.VerifyAccessToken(result => {
         result.Match(
             value => {
             UpdateRawSection(value);
         },
             error => {
             UpdateRawSection(error);
         }
             );
     });
 }