public void RetrievesANewTopFlag() { Server.Stub(new ApiExpectation { Response = @"{top_score: true}" }); var score = new Score { Points = 10039, UserName = "******" }; new Driver("thekey", "sssshh").SaveScore("mybaloney", score, "gom jabbar", ranks => { Assert.AreEqual(true, ranks.Data.TopScore); Set(); }); WaitOne(); }
public void RetrievesAnEmptyRankSet() { Server.Stub(new ApiExpectation { Response = @"{}" }); var score = new Score { Points = 10039, UserName = "******", }; new Driver("thekey", "sssshh").SaveScore("mybaloney", score, "gom jabbar", ranks => { Assert.AreEqual(0, ranks.Data.Daily); Assert.AreEqual(0, ranks.Data.Weekly); Assert.AreEqual(0, ranks.Data.Overall); Set(); }); WaitOne(); }
public void RetrievesAllTheRanksFromTheResponse() { Server.Stub(new ApiExpectation { Response = @"{""daily"": 20, ""weekly"": 25, ""overall"": 45}" }); var score = new Score { Points = 10039, UserName = "******" }; new Driver("thekey", "sssshh").SaveScore("mybaloney", score, "gom jabbar", ranks => { Assert.AreEqual(true, ranks.Success); Assert.AreEqual(20, ranks.Data.Daily); Assert.AreEqual(25, ranks.Data.Weekly); Assert.AreEqual(45, ranks.Data.Overall); Set(); }); WaitOne(); }
public void SaveScore(string leaderboardId, Score score, Action<Ranks> callback) { _driver.SaveScore(leaderboardId, score, callback); }
public void SaveScore(string leaderboardId, Score score, Action<Response<Ranks>> callback) { _driver.SaveScore(leaderboardId, score, GetUniqueIdentifier(), callback); }
public void SendsScoreWithoutDataToTheServer() { Server.Stub(new ApiExpectation { Method = "PUT", Url = "/scores", Request = @"{""leaderboard_id"":""mybaloney"",""score"":{""username"":""Scytale"",""points"":10039,""unique"":""gom jabbar""},""key"":""thekey"",""v"":1,""sig"":""b3a25f82263d56640ba29572699b29d6""}", Response = "{}" }); var score = new Score { Points = 10039, UserName = "******"}; new Driver("thekey", "sssshh").SaveScore("mybaloney", score, "gom jabbar", SetIfSuccess); WaitOne(); }
public void SendsScoreWithDataToTheServer() { Server.Stub(new ApiExpectation { Method = "PUT", Url = "/scores", Request = @"{""leaderboard_id"":""mybaloney"",""score"":{""username"":""Scytale"",""points"":10039,""data"":""mydata"",""unique"":""gom jabbar""},""key"":""thekey"",""v"":1,""sig"":""af421951f2b5d691e9ec42ba30a61c34""}" }); var score = new Score { Points = 10039, UserName = "******", Data = "mydata" }; new Driver("thekey", "sssshh").SaveScore("mybaloney", score, "gom jabbar", SetIfSuccess); WaitOne(); }