Exemplo n.º 1
0
        private void GetObjectCallback1(GetObjectsResponse result)
        {
            var testContext = (UUnitTestContext)result.CustomData;

            _testInteger = 0; // Default if the data isn't present
            foreach (var eachObjPair in result.Objects)
            {
                if (eachObjPair.Key == TEST_OBJ_NAME)
                {
                    int.TryParse(eachObjPair.Value.EscapedDataObject, out _testInteger);
                }
            }

            _testInteger = (_testInteger + 1) % 100; // This test is about the Expected value changing - but not testing more complicated issues like bounds

            var updateRequest = new SetObjectsRequest
            {
                Entity  = _entityKey,
                Objects = new List <SetObject> {
                    new SetObject {
                        ObjectName = TEST_OBJ_NAME, DataObject = _testInteger
                    }
                }
            };

            PlayFabEntityAPI.SetObjects(updateRequest, PlayFabUUnitUtils.ApiActionWrapper <SetObjectsResponse>(testContext, UpdateObjectCallback), PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext);
        }
Exemplo n.º 2
0
        private void GetObjectCallback2(GetObjectsResponse result)
        {
            var testContext = (UUnitTestContext)result.CustomData;

            testContext.IntEquals(result.Objects.Count, 1, "Incorrect number of entity objects: " + result.Objects.Count);
            testContext.True(result.Objects.ContainsKey(TEST_OBJ_NAME), "Expected Test object not found: " + result.Objects.Keys.FirstOrDefault());
            var actualInteger = int.Parse(result.Objects[TEST_OBJ_NAME].EscapedDataObject);

            testContext.IntEquals(_testInteger, actualInteger, "Entity Object was not updated: " + actualInteger + "!=" + _testInteger);

            testContext.EndTest(UUnitFinishState.PASSED, actualInteger.ToString());
        }
    private void OnGetObjectsSuccess(GetObjectsResponse response)
    {
        Debug.Log("Background color was retrieved successfully");

        ObjectResult result = null;

        response.Objects.TryGetValue("BackgroundColor", out result);

        if (result != null)
        {
            BackgroundColor backgroundColor = JsonUtility.FromJson <BackgroundColor>(result.DataObject.ToString());
            Camera.main.backgroundColor = new Color(backgroundColor.R, backgroundColor.G, backgroundColor.B, backgroundColor.A);
        }
    }
Exemplo n.º 4
0
        private void GetObjectCallback2(GetObjectsResponse result)
        {
            var testContext = (UUnitTestContext)result.CustomData;

            var actualInteger = -100; // Default if the data isn't present

            testContext.IntEquals(result.Objects.Count, 1, "Incorrect number of entity objects: " + result.Objects.Count);
            testContext.StringEquals(result.Objects[0].ObjectName, TEST_OBJ_NAME, "Expected Test object not found: " + result.Objects[0].ObjectName);
            actualInteger = int.Parse(result.Objects[0].EscapedDataObject);
            testContext.True(actualInteger != -100, "Entity object not set");
            testContext.IntEquals(_testInteger, actualInteger, "Entity Object was not updated: " + actualInteger + "!=" + _testInteger);

            testContext.EndTest(UUnitFinishState.PASSED, null);
        }