public void APITestGetProfileOk() { var json = @" { ""displayName"": ""testuser"", ""userId"": ""user_id"", ""pictureUrl"": ""https://example.com/abcd"", ""statusMessage"": ""Hi"" } "; var called = false; LineAPI.GetProfile(result => { Assert.True(result.IsSuccess); result.MatchOk(profile => { called = true; Assert.AreEqual("user_id", profile.UserId); Assert.AreEqual("testuser", profile.DisplayName); Assert.AreEqual("Hi", profile.StatusMessage); Assert.AreEqual("https://example.com/abcd", profile.PictureUrl); Assert.AreEqual("https://example.com/abcd/large", profile.PictureUrlLarge); Assert.AreEqual("https://example.com/abcd/small", profile.PictureUrlSmall); }); }); var identifier = LineAPI.actions.Keys.ToList()[0]; LineAPI._OnApiOk(CallbackPayload.WrapValue(identifier, json)); Assert.True(called); Assert.IsEmpty(LineAPI.actions); }
public void GetProfile() { LineAPI.GetProfile(result => { result.Match( value => { StartCoroutine(UpdateProfile(value)); UpdateRawSection(value); }, error => { UpdateRawSection(error); } ); }); }