formatBC() public static method

public static formatBC ( string str, string color ) : string
str string
color string
return string
Beispiel #1
0
    public static void overview()
    {
        LeanTest.testsFinished = true;
        int    num = LeanTest.expected - LeanTest.passes;
        string str = (num > 0 ? LeanTest.formatBC(string.Concat(num), "red") : string.Concat(num));

        Debug.Log(string.Concat(new string[] { LeanTest.formatB("Final Report:"), " _____________________ PASSED: ", LeanTest.formatBC(string.Concat(LeanTest.passes), "green"), " FAILED: ", str, " " }));
    }
Beispiel #2
0
    public static void debug(string name, bool didPass, string failExplaination = null)
    {
        float  num   = LeanTest.printOutLength(name);
        int    num2  = 40 - (int)(num * 1.05f);
        string text  = string.Empty.PadRight(num2, "_".get_Chars(0));
        string text2 = string.Concat(new string[]
        {
            LeanTest.formatB(name),
            " ",
            text,
            " [ ",
            didPass ? LeanTest.formatC("pass", "green") : LeanTest.formatC("fail", "red"),
            " ]"
        });

        if (!didPass && failExplaination != null)
        {
            text2 = text2 + " - " + failExplaination;
        }
        Debug.Log(text2);
        if (didPass)
        {
            LeanTest.passes++;
        }
        LeanTest.tests++;
        if (LeanTest.tests == LeanTest.expected)
        {
            Debug.Log(string.Concat(new string[]
            {
                LeanTest.formatB("Final Report:"),
                " _____________________ PASSED: ",
                LeanTest.formatBC(string.Empty + LeanTest.passes, "green"),
                " FAILED: ",
                LeanTest.formatBC(string.Empty + (LeanTest.tests - LeanTest.passes), "red"),
                " "
            }));
        }
        else if (LeanTest.tests > LeanTest.expected)
        {
            Debug.Log(LeanTest.formatB("Too many tests for a final report!") + " set LeanTest.expected = " + LeanTest.tests);
        }
    }