Example #1
0
 /// <summary>
 /// Verifies that the two strings are equal to each other.
 /// </summary>
 /// <param name="expected">The expected text.</param>
 /// <param name="actual">The actual text.</param>
 /// <param name="location">A description of where the comparison took place.</param>
 public void AreEqual(string expected, string actual, string location)
 {
     if (!string.Equals(expected, actual))
     {
         var message = string.Format(
             CultureInfo.InvariantCulture,
             "Fail: Expected: {0}. Actual: {1}",
             expected,
             actual);
         m_Log.Error(location, message);
         m_Result.AddError(location + " - " + message);
     }
 }
Example #2
0
        static int Main()
        {
            // Minimize directly on start-up so that we can't take focus on our own window
            MinimizeConsoleWindow();

            var globalResult = new TestResult();
            try
            {
                // Initialize the container
                var container = DependencyInjection.Load();
                InitializeWhite(container);

                var reporters = container.Resolve<IEnumerable<IReporter>>();
                var log = container.Resolve<Log>();

                var applicationPath = ApplicationProxies.GetApolloExplorerPath(log);
                if (string.IsNullOrEmpty(applicationPath))
                {
                    var message = "Could not find application path.";
                    reporters.ForEach(r => r.AddErrorMessage(message));
                    globalResult.AddError(message);
                }

                // Select the type of test to execute
                var views = container.ResolveKeyed<IUserInterfaceVerifier>(typeof(VerifyViews));
                var projects = container.ResolveKeyed<IUserInterfaceVerifier>(typeof(VerifyProject));
                foreach (var testCase in views.TestsToExecute().Append(projects.TestsToExecute()))
                {
                    var message = string.Format(
                        CultureInfo.InvariantCulture,
                        "Starting: {0}",
                        testCase.Name);
                    reporters.ForEach(r => r.AddInformationalMessage(message));
                    var localResult = ExecuteTestCase(testCase, log, applicationPath);
                    if (localResult.Status == TestStatus.Passed)
                    {
                        var succesMessage = string.Format(
                            CultureInfo.InvariantCulture,
                            "Successfully completed test: {0}",
                            testCase.Name);
                        reporters.ForEach(r => r.AddInformationalMessage(succesMessage));
                    }
                    else
                    {
                        foreach (var error in localResult.Errors)
                        {
                            var failMessage = error;
                            globalResult.AddError(error);
                            reporters.ForEach(r => r.AddErrorMessage(failMessage));
                        }
                    }
                }
            }
            catch (Exception e)
            {
                var message = string.Format(
                    CultureInfo.InvariantCulture,
                    "Unhandled exception occurred during the execution of the regression tests. Error was: {0}",
                    e);
                globalResult.AddError(message);
            }

            return globalResult.Status == TestStatus.Passed ? NormalApplicationExitCode : UnhandledExceptionApplicationExitCode;
        }
Example #3
0
        static int Main()
        {
            // Minimize directly on start-up so that we can't take focus on our own window
            MinimizeConsoleWindow();

            var globalResult = new TestResult();

            try
            {
                // Initialize the container
                var container = DependencyInjection.Load();
                InitializeWhite(container);

                var reporters = container.Resolve <IEnumerable <IReporter> >();
                var log       = container.Resolve <Log>();

                var applicationPath = ApplicationProxies.GetApolloExplorerPath(log);
                if (string.IsNullOrEmpty(applicationPath))
                {
                    var message = "Could not find application path.";
                    reporters.ForEach(r => r.AddErrorMessage(message));
                    globalResult.AddError(message);
                }

                // Select the type of test to execute
                var views    = container.ResolveKeyed <IUserInterfaceVerifier>(typeof(VerifyViews));
                var projects = container.ResolveKeyed <IUserInterfaceVerifier>(typeof(VerifyProject));
                foreach (var testCase in views.TestsToExecute().Append(projects.TestsToExecute()))
                {
                    var message = string.Format(
                        CultureInfo.InvariantCulture,
                        "Starting: {0}",
                        testCase.Name);
                    reporters.ForEach(r => r.AddInformationalMessage(message));
                    var localResult = ExecuteTestCase(testCase, log, applicationPath);
                    if (localResult.Status == TestStatus.Passed)
                    {
                        var succesMessage = string.Format(
                            CultureInfo.InvariantCulture,
                            "Successfully completed test: {0}",
                            testCase.Name);
                        reporters.ForEach(r => r.AddInformationalMessage(succesMessage));
                    }
                    else
                    {
                        foreach (var error in localResult.Errors)
                        {
                            var failMessage = error;
                            globalResult.AddError(error);
                            reporters.ForEach(r => r.AddErrorMessage(failMessage));
                        }
                    }
                }
            }
            catch (Exception e)
            {
                var message = string.Format(
                    CultureInfo.InvariantCulture,
                    "Unhandled exception occurred during the execution of the regression tests. Error was: {0}",
                    e);
                globalResult.AddError(message);
            }

            return(globalResult.Status == TestStatus.Passed ? NormalApplicationExitCode : UnhandledExceptionApplicationExitCode);
        }