コード例 #1
0
        public static void CheckResults(List <TestExecutionResults> results, TestProjectRunnerArguments args)
        {
            Assert.That(results.Count, Is.EqualTo(args.Versions.Count));

            for (int versionIndex = 0; versionIndex < args.Versions.Count; versionIndex++)
            {
                string projectPath           = TestProjectUtil.GetProjectPath(args, versionIndex);
                string testsToRunFilePath    = Path.Combine(projectPath, "toRun.json");
                string testsToRunFileContent = File.ReadAllText(testsToRunFilePath);
                ToRun  runInfo = JsonConvert.DeserializeObject <ToRun>(testsToRunFileContent);

                List <string> testsToRun = args.DependencyCollectionGranularity == DependencyCollectionGranularity.Class ?
                                           runInfo.TestsToRun : runInfo.MethodsToRun;
                ISet <string> runTests = args.DependencyCollectionGranularity == DependencyCollectionGranularity.Class ?
                                         results[versionIndex].ExecutedTestClasses : results[versionIndex].ExecutedTestMethods;

                Assert.That(runTests.Count, Is.EqualTo(testsToRun.Count), $"Number of tests run not equal in version {versionIndex}");

                for (int testIndex = 0; testIndex < testsToRun.Count; testIndex++)
                {
                    Assert.That(runTests.Contains(testsToRun[testIndex]), $"Test not run: {testsToRun[testIndex]} in version: {versionIndex}");
                }

                if (results[versionIndex].FailedTestMethodsCount > 0)
                {
                    // if there is some test that failed
                    StringBuilder failedTests = new StringBuilder();
                    foreach (string failedTest in results[versionIndex].FailedTestMethods)
                    {
                        failedTests.Append($"{failedTest}\n");
                    }
                    Assert.Fail($"There were failing test cases:\n{failedTests.ToString()}");
                }
            }
        }
コード例 #2
0
        public MainWindow()
        {
            InitializeComponent();

            sortType    = new SortType();
            DataContext = sortType;
            status      = new Status();
            Binding statusBind1 = new Binding
            {
                Source = status,
                Path   = new PropertyPath("IsGenerateEn")
            };
            Binding statusBind2 = new Binding
            {
                Source = status,
                Path   = new PropertyPath("IsDataValid")
            };
            Binding statusBind3 = new Binding
            {
                Source = status,
                Path   = new PropertyPath("ToRunContent")
            };

            Generate.SetBinding(Button.IsEnabledProperty, statusBind1);
            ToRun.SetBinding(Button.IsEnabledProperty, statusBind2);
            ToRun.SetBinding(Button.ContentProperty, statusBind3);
        }