public IAssertionResult WarningInTheScene()
    {
        IAssertionResult result = null;

        if (this.WarningTextObject == null)
        {
            result = new AssertionResultRetry("No warning on the scene");
        }
        else if (!this.WarningTextObject.activeSelf)
        {
            result = new AssertionResultRetry("No visible warning on the scene");
        }
        else
        {
            Text text = this.WarningTextObject.GetComponent <Text>();
            if (text.text.Equals(this.ExpectedWarningText))
            {
                result = new AssertionResultSuccessful();
            }
            else
            {
                result = new AssertionResultFailed("The warning message has not the expected text: \"" + text.text + "\" instead of \"" + this.ExpectedWarningText);
            }
        }

        return(result);
    }
    public IAssertionResult OnlyACubeInTheScene()
    {
        IAssertionResult result = null;

        GameObject[] cubes = GameObject.FindGameObjectsWithTag(CubeTag);
        if (this.listOfCubesInTheScene.SequenceEqual(cubes) == false)
        {
            result = new AssertionResultFailed("The objects in the scene are changed!");
        }
        else
        {
            result = new AssertionResultSuccessful();
        }

        return(result);
    }
コード例 #3
0
    public IAssertionResult StartedAndWaitingForInput()
    {
        IAssertionResult result       = null;
        GameObject       cube         = GameObject.FindWithTag(CubeTag);
        GameObject       buttonCreate = GameObject.FindWithTag(ButtonCreateTag);

        if (buttonCreate == null)
        {
            result = new AssertionResultRetry("Button Create not found");
        }
        else if (cube != null)
        {
            result = new AssertionResultFailed("There is an unexpected cube in the scene.");
        }
        else if (buttonCreate != null && buttonCreate.activeSelf)
        {
            result = new AssertionResultSuccessful();
        }

        return(result);
    }