void DeleteMembership() { var oldMembershipId = string.Copy(membership.Id); StartCoroutine(membership.Delete(error => { Fail(error.Message); }, success => { // Double check (Expect get to know fail). var checkDelete = new Membership(oldMembershipId); StartCoroutine(checkDelete.Load(error => { Debug.Log(error.Message); TestEnd(); }, getSuccess => { Fail("Should fail to Get deleted Membership"); })); })); }
void GetMembership() { var retrieve = new Membership(membership.Id); StartCoroutine(retrieve.Load(error => { // Failed! Fail(error.Message); }, success => { if (retrieve.Room.Id == membership.Room.Id) { // Create is now known to have passed here. Debug.Log("Create Membership Passed!"); // Get Membership just passed. Debug.Log("Get Membership Passed!"); // Move on. UpdateMembership(); } })); }
void UpdateMembership() { // Let's set moderator to true. if (membership.IsModerator == true) { Fail("Moderator should start false"); } else { membership.IsModerator = true; StartCoroutine(membership.Commit(error => { // Failed. Fail(error.Message); }, success => { // Looks like it's worked, let's check. var checkingModerator = new Membership(membership.Id); StartCoroutine(checkingModerator.Load(error => { Fail(error.Message); }, checkSuccess => { if (checkingModerator.IsModerator) { // Now we know Update passed for sure. Debug.Log("Update Membership Passed!"); ListMemberships(); } })); })); } }