Example #1
0
    public void APITestRevokeTokenOk()
    {
        var json   = "{}";
        var called = false;

        LineAPI.RevokeAccessToken(result => {
            called = true;
            Assert.True(result.IsSuccess);
        });

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

        LineAPI._OnApiOk(CallbackPayload.WrapValue(identifier, json));
        Assert.True(called);
    }
Example #2
0
    public void APITestRevokeTokenError()
    {
        var json   = @"
        {
            ""code"": 123,
            ""message"": ""error""
        }
        ";
        var called = false;

        LineAPI.RevokeAccessToken(result => {
            Assert.True(result.IsFailure);
            result.MatchError(error => {
                called = true;
                Assert.AreEqual(123, error.Code);
                Assert.AreEqual("error", error.Message);
            });
        });

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

        LineAPI._OnApiError(CallbackPayload.WrapValue(identifier, json));
        Assert.True(called);
    }