public void SendScore(int score, string leaderboardId)
 {
     platform.ReportScore(score, leaderboardId, (bool success) => {
         if (!success)
         {
             Debug.LogWarning("Leaderboard: Score not sent.");
         }
     });
 }
        public void ReportScoreIsWorksWhenAuthenticated()
        {
            var mockClient = new LeaderboardClient();
            var platform   = new PlayGamesPlatform(mockClient);

            platform.ReportScore(200L, "leaderboard", SentinelCallback);
            Assert.AreEqual("leaderboard", mockClient.SubmittedId);
            Assert.AreEqual(200L, mockClient.SubmittedScore);
            Assert.AreSame(SentinelCallback, mockClient.SubmitCallback);
        }
        public void ReportScoreIsWorksWhenIdMapped()
        {
            var mockClient = new LeaderboardClient();
            var platform   = new PlayGamesPlatform(mockClient);

            platform.AddIdMapping("unmappedLeaderboard", "mappedLeaderboard");

            platform.ReportScore(300L, "unmappedLeaderboard", SentinelCallback);

            Assert.AreEqual("mappedLeaderboard", mockClient.SubmittedId);
            Assert.AreEqual(300L, mockClient.SubmittedScore);
            Assert.AreSame(SentinelCallback, mockClient.SubmitCallback);
        }
        public void ReportScoreIsNoOpWhenUnauthenticated()
        {
            var mockClient        = new LeaderboardClient();
            var platform          = new PlayGamesPlatform(mockClient);
            var capturingCallback = new CapturingAction <bool>();

            mockClient.Authenticated = false;

            platform.ReportScore(100, "leaderboard", capturingCallback.invoke);
            Assert.IsNull(mockClient.SubmittedId);
            Assert.IsNull(mockClient.SubmittedScore);
            Assert.IsFalse(capturingCallback.Captured);
        }