AWSSDK.Tests.Framework.TestRunner.TestListener.TestFinished C# (CSharp) Method

TestFinished() public method

public TestFinished ( ITestResult result ) : void
result ITestResult
return void
            public void TestFinished(ITestResult result)
            {
                var testAssembly = result.Test as TestAssembly;
                if (testAssembly != null)
                {
                    Debug.Log(string.Format("=== Executed {0} tests in assembly {1} ===",
                        testAssembly.TestCaseCount,
                        testAssembly.Assembly.FullName));

                    Debug.Log(string.Format("\nPassed : {0}\tFailed : {1}",
                        result.PassCount, result.FailCount));
                }

                var testFixture = result.Test as TestFixture;
                if (testFixture != null)
                {
                    if (result.FailCount > 0)
                    {
                        Debug.Log(string.Format("Test Fixture {0} ({1}) has {2} failures.",
                            testFixture.Name, testFixture.FullName, result.FailCount));

                        if (result.HasChildren)
                        {
                            foreach (var childResult in result.Children)
                            {
                                if (childResult.ResultState.Site != FailureSite.Test)
                                    TestFinished(childResult);
                            }
                        }

                        Debug.Log(string.Format("\tMessage : {0}", result.Message));
                        Debug.Log(string.Format("\tStack trace : {0}", result.StackTrace));

                    }
                    Debug.Log(string.Format("  --- Executed tests in class {0}   ---\n", testFixture.FullName));
                }

                var testMethod = result.Test as TestMethod;
                if (testMethod != null)
                {
                    if (result.FailCount > 0)
                    {
                        Debug.Log(string.Format("FAIL {0} ({1})", testMethod.MethodName, testMethod.FullName));
                        Debug.Log(string.Format("\tMessage : {0}", result.Message));
                        Debug.Log(string.Format("\tStack trace : {0}", result.StackTrace));
                    }

                    if (result.InconclusiveCount > 0)
                    {
                        Debug.Log(string.Format("INCONCLUSIVE {0}", testMethod.MethodName));
                    }

                    if (result.PassCount > 0)
                    {
                        Debug.Log(string.Format("PASS {0}", testMethod.MethodName));
                    }

                    var testSucceeded =
                        result.FailCount == 0 &&
                        result.InconclusiveCount == 0 &&
                        result.SkipCount == 0;

                    TestCompleted(testMethod.Name, testSucceeded);
                }
            }