public void TestRunning() { TestCaseDummy local = new TestCaseDummy("TestMethod"); UUnitAssert.False(local.wasRun, " not wasRun"); local.Run(); UUnitAssert.True(local.wasRun, "wasRun"); }
public void TestCallbackFailures() { PlayFabSettings.HideCallbackErrors = true; // Just need any valid auth token for this test LoginWithCustomIDRequest loginRequest = new LoginWithCustomIDRequest(); loginRequest.CreateAccount = true; loginRequest.CustomId = "Custom ID"; //SystemInfo.deviceUniqueIdentifier; PlayFabClientAPI.LoginWithCustomID(loginRequest, null, null); WaitForApiCalls(); PlayFabSettings.RegisterForResponses(null, (PlayFabSettings.ResponseCallback <object, PlayFabResultCommon>)SuccessCallback_Global); PlayFabSettings.GlobalErrorHandler += SharedError_Global; callbacks.Clear(); GetCatalogItemsRequest catalogRequest = new GetCatalogItemsRequest(); PlayFabClientAPI.GetCatalogItems(catalogRequest, GetCatalogItemsCallback_Single, SharedError_Single); WaitForApiCalls(); UUnitAssert.True(callbacks.Contains("GetCatalogItemsCallback_Single"), "GetCatalogItemsCallback_Single"); // All success callbacks should occur, even if some throw exceptions UUnitAssert.True(callbacks.Contains("SuccessCallback_Global"), "SuccessCallback_Global"); // All success callbacks should occur, even if some throw exceptions UUnitAssert.False(callbacks.Contains("SharedError_Single"), "SharedError_Single"); // Successful calls should not invoke error-callbacks (even when callbacks throw exceptions) UUnitAssert.False(callbacks.Contains("SharedError_Global"), "SharedError_Global"); // Successful calls should not invoke error-callbacks (even when callbacks throw exceptions) UUnitAssert.IntEquals(2, callbacks.Count); callbacks.Clear(); RegisterPlayFabUserRequest registerRequest = new RegisterPlayFabUserRequest(); PlayFabClientAPI.RegisterPlayFabUser(registerRequest, RegisterPlayFabUserCallback_Single, SharedError_Single); WaitForApiCalls(); UUnitAssert.False(callbacks.Contains("GetCatalogItemsCallback_Single"), "GetCatalogItemsCallback_Single"); // Success should not have occurred UUnitAssert.False(callbacks.Contains("SuccessCallback_Global"), "SuccessCallback_Global"); // Success should not have occurred UUnitAssert.True(callbacks.Contains("SharedError_Single"), "SharedError_Single"); // All error callbacks should occur, even if some throw exceptions UUnitAssert.True(callbacks.Contains("SharedError_Global"), "SharedError_Global"); // All error callbacks should occur, even if some throw exceptions UUnitAssert.IntEquals(2, callbacks.Count); callbacks.Clear(); PlayFabSettings.HideCallbackErrors = false; PlayFabSettings.ForceUnregisterAll(); }
public void TestAllMethods() { PrefixTest(); SpriteLayer clothesLayer = new ClothesLayer(); SpriteLayer weaponLayer = new WeaponLayer(); animation.PutLayer(clothesLayer); animation.PutLayer(weaponLayer); if (animation.IsPlaying) { animation.Stop(); UUnitAssert.False(animation.IsPlaying); animation.Play(); UUnitAssert.True(animation.IsPlaying); } else { animation.Play(); UUnitAssert.True(animation.IsPlaying); animation.Stop(); UUnitAssert.False(animation.IsPlaying); } weaponLayer = animation.GetLayer(LayerID.WEAPON); UUnitAssert.NotNull(weaponLayer); animation.Clear(weaponLayer); weaponLayer = animation.GetLayer(weaponLayer.id); UUnitAssert.NotNull(weaponLayer); weaponLayer.spritePrefab = weaponPrefab; animation.PutLayer(weaponLayer); animation.Open(clothesPrefab1, LayerID.CLOTHES); }
public void WriteTestSequence() { bool functionResult, callResult; string getErrorReport, saveErrorReport, fetchErrorReport; TestSuiteReport[] testResults; object nullReturn; // Reset a previous test if relevant callResult = CloudScriptListener.ExecuteCloudScript(CloudScriptListener.CSfunc_GetTestData, getRequest, out testResults, out fetchErrorReport); UUnitAssert.True(callResult, fetchErrorReport); // Verify that no data pre-exists callResult = CloudScriptListener.ExecuteCloudScript(CloudScriptListener.CSfunc_TestDataExists, getRequest, out functionResult, out getErrorReport); UUnitAssert.True(callResult, getErrorReport); UUnitAssert.False(functionResult, getErrorReport); // Save some data callResult = CloudScriptListener.ExecuteCloudScript(CloudScriptListener.CSfunc_SaveTestData, saveRequest, out nullReturn, out saveErrorReport); UUnitAssert.True(callResult, saveErrorReport); // Verify that the saved data exists callResult = CloudScriptListener.ExecuteCloudScript(CloudScriptListener.CSfunc_TestDataExists, getRequest, out functionResult, out getErrorReport); UUnitAssert.True(callResult, getErrorReport); UUnitAssert.True(functionResult, saveErrorReport); // Fetch that data callResult = CloudScriptListener.ExecuteCloudScript(CloudScriptListener.CSfunc_GetTestData, getRequest, out testResults, out fetchErrorReport); UUnitAssert.True(callResult, fetchErrorReport); UUnitAssert.NotNull(testResults, fetchErrorReport); // Verify that it was consumed callResult = CloudScriptListener.ExecuteCloudScript(CloudScriptListener.CSfunc_TestDataExists, getRequest, out functionResult, out getErrorReport); UUnitAssert.True(callResult, getErrorReport); UUnitAssert.False(functionResult, getErrorReport); }
public void HealthObjectShouldNotBeAbleToAttackTwice() { _enemyHealthManager.Attack(); UUnitAssert.False(_enemyHealthManager.CanAttack(), "Enemy should not be able to attack after attacking"); }