public void GetFriendshipStatus()
 {
     LineAPI.GetBotFriendshipStatus(result => {
         result.Match(
             value => {
             UpdateRawSection(value);
         },
             error => {
             UpdateRawSection(error);
         }
             );
     });
 }
Пример #2
0
    public void APITestGetBotFriendshipStatusOk()
    {
        var json   = @"
        {
            ""friendFlag"": true
        }
        ";
        var called = false;

        LineAPI.GetBotFriendshipStatus(result => {
            Assert.True(result.IsSuccess);
            result.MatchOk(value => {
                called = true;
                Assert.True(value.IsFriend);
            });
        });

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

        LineAPI._OnApiOk(CallbackPayload.WrapValue(identifier, json));
        Assert.True(called);
        Assert.IsEmpty(LineAPI.actions);
    }
Пример #3
0
    public void APITestGetBotFriendshipStatusError()
    {
        var json   = @"
        {
            ""code"": 123,
            ""message"": ""error""
        }
        ";
        var called = false;

        LineAPI.GetBotFriendshipStatus(result => {
            called = true;
            Assert.True(result.IsFailure);
            result.MatchError(error => {
                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);
    }