public IEnumerator UserCreatesTwoNetsWithAllErrors() { yield return(Install()); yield return(0); // Checks initial state and clicks create button Assert.AreEqual(1, GameObject.FindObjectsOfType <DataNetCreationErrorDisplay>().Length); DataNetCreationErrorDisplay errorDisplay = GameObject.FindObjectOfType <DataNetCreationErrorDisplay>(); Assert.AreEqual(_creationData.GetHashCode(), errorDisplay.CreationData.GetHashCode()); checkErrorDisplayEmpty(errorDisplay); DataNetNameInput nameInput = GameObject.FindObjectOfType <DataNetNameInput>(); Assert.AreEqual(_creationData.GetHashCode(), nameInput.CreationData.GetHashCode()); checkInputFieldEmpty(nameInput); DataNetCreationButton creationButton = GameObject.FindObjectOfType <DataNetCreationButton>(); creationButton.Button.onClick.Invoke(); yield return(0); // Checks error display and enters first net name checkErrorDisplayed(errorDisplay); enterName(nameInput, _firstNetName); yield return(0); // Checks error not displayed anymore and clicks create button checkErrorDisplayEmpty(errorDisplay); creationButton.Button.onClick.Invoke(); yield return(0); // Checks if net and also the list element have been created and enters the name of the first net again. NetSelectionElementsCreator netSelectionElementsCreator = GameObject.FindObjectOfType <NetSelectionElementsCreator>(); checkNetElementsCreated(netSelectionElementsCreator); checkInputFieldEmpty(nameInput); enterName(nameInput, _firstNetName); creationButton.Button.onClick.Invoke(); yield return(0); // Checks if the expected error is display, enters second net name and clicks create button checkErrorDisplayed(errorDisplay); enterName(nameInput, _secondNetName); creationButton.Button.onClick.Invoke(); yield return(0); // Checks if the error display is empty, // checks if second net has been created, // checks if name input is empty, checkNetElementsCreated(netSelectionElementsCreator); checkInputFieldEmpty(nameInput); checkErrorDisplayEmpty(errorDisplay); }
private void checkErrorDisplayEmpty(DataNetCreationErrorDisplay errorDisplay) { Assert.AreEqual(string.Empty, _creationData.Error); Assert.AreEqual(string.Empty, errorDisplay.TextField.text); }