public void Teardown() { GameObject.Destroy(testObj); FurnitureTriggerInfo.DeactivateFurniture(); GameObject.Destroy(gui); }
/// <summary> /// Dectivate the furnitrue. /// Disables the furniture info window. /// </summary> public void Deactivate() { if (isTriggerd) { isTriggerd = false; FurnitureTriggerInfo.DeactivateFurniture(); } }
/// <summary> /// Activate the furnitrue. /// Sets the furniture info window. /// </summary> public void Activate(FurnitureType type, FurnitureInfo info) { if (FurnitureTriggerInfo.Type == FurnitureType.None) { isTriggerd = true; FurnitureTriggerInfo.SetActiveFurniture(type, info); } }
public void DeactivateFunitureSetsTypeToNone_Test() { // setup FurnitureTriggerInfo.Type = FurnitureType.CArm; // perform FurnitureTriggerInfo.DeactivateFurniture(); // assert Assert.AreEqual(FurnitureType.None, FurnitureTriggerInfo.Type); }
public void DeactivateFurnitureDeactivatesFurnitureInfoUI_Test() { // perform FurnitureTriggerInfo.DeactivateFurniture(); // get bool active = GameObject.Find("GUI").transform.Find("FurnitureInfo").gameObject.activeSelf; // assert Assert.IsFalse(active); }
public void SetActiveFurnitureSetsCorrectFurnitureType_Test(FurnitureType expected) { // setup FurnitureInfo info = new FurnitureInfo(expected.ToString(), expected.ToString(), new KeyCode[] { }); // perform FurnitureTriggerInfo.SetActiveFurniture(expected, info); // assert Assert.AreEqual(expected, FurnitureTriggerInfo.Type); }
public void SetActiveFurnitureThrowsWarningMessageWhenFurnitureInfoHasMoreThanTwoKeyCodes_Test() { // setup FurnitureInfo info = new FurnitureInfo("example", "example", new KeyCode[] { KeyCode.A, KeyCode.B, KeyCode.C }); // perform FurnitureTriggerInfo.SetActiveFurniture(FurnitureType.CArm, info); // assert LogAssert.Expect(LogType.Warning, "The GUI can only handle two different keys!"); }
public void SetActiveFurnitureActivatesFurnitureInfoUI_Test() { // setup FurnitureInfo info = new FurnitureInfo("example", "example", new KeyCode[] { }); // perform FurnitureTriggerInfo.SetActiveFurniture(FurnitureType.CArm, info); // get bool active = GameObject.Find("GUI/FurnitureInfo").activeSelf; // assert Assert.IsTrue(active); }
public void SetActiveFurnitureLoadsCorrectFurnitureNameIntoUI_Test(FurnitureType type) { // setup string expected = type.ToString(); FurnitureInfo info = new FurnitureInfo(expected, expected, new KeyCode[] { }); // perform FurnitureTriggerInfo.SetActiveFurniture(type, info); // get string actual = GameObject.Find("GUI/FurnitureInfo/Name").GetComponent <TextMeshProUGUI>().text; // assert Assert.AreEqual(expected, actual); }
public void SetActiveFurnitureLoadsCorrectKeyCodesIntoUIForTwoKeys_Test(FurnitureType type, KeyCode[] keys) { // setup string expected = type.ToString(); FurnitureInfo info = new FurnitureInfo(expected, expected, keys); // perform FurnitureTriggerInfo.SetActiveFurniture(type, info); // get string actual0 = GameObject.Find("GUI/FurnitureInfo/Keys/1/KeyName").GetComponent <TextMeshProUGUI>().text; string actual1 = GameObject.Find("GUI/FurnitureInfo/Keys/2/KeyName").GetComponent <TextMeshProUGUI>().text; // assert Assert.AreEqual(keys[0].ToString(), actual0); Assert.AreEqual(keys[1].ToString(), actual1); }
public void SetActiveFurnitureLoadsCorrectKeyCodesIntoUIForZeroKeys_Test(FurnitureType type) { // setup string expected = ""; string name = type.ToString(); FurnitureInfo info = new FurnitureInfo(name, name, new KeyCode[] { }); // perform FurnitureTriggerInfo.SetActiveFurniture(FurnitureType.CArm, info); // get string actual0 = GameObject.Find("GUI/FurnitureInfo/Keys/1/KeyName").GetComponent <TextMeshProUGUI>().text; string actual1 = GameObject.Find("GUI/FurnitureInfo/Keys/2/KeyName").GetComponent <TextMeshProUGUI>().text; // assert Assert.AreEqual(expected, actual0); Assert.AreEqual(expected, actual1); }