コード例 #1
0
        public void SplitIntoCells_VariousValueCombinations_ResultAsExpected(Object data)
        {
            TestCaseItem item = (TestCaseItem)data;

            List <String> actual = ProcessHelper.SplitIntoCells(item.Value, item.Separator);

            Assert.That(String.Join(String.Empty, actual), Is.EqualTo(String.Join(String.Empty, item.Expected)));
        }
コード例 #2
0
        public void AssemblyQuickInfoTest(TestCaseItem testCase)
        {
            // Given
            _output.WriteLine(testCase.TestDescription);

            // When

            // Then
            Assert.Equal(testCase.ExpectedPropertyValue, testCase.ActualPropertyValue);
        }
コード例 #3
0
ファイル: Z80TestManager.cs プロジェクト: rdacomp/spectnetide
        /// <summary>
        /// Executes the specified test case
        /// </summary>
        /// <param name="vm">Test explorer view model</param>
        /// <param name="testToRun">Test that hosts the test case</param>
        /// <param name="caseToRun">Test case to run</param>
        /// <param name="token">Token to cancel tests</param>
        private async Task ExecuteCaseAsync(TestExplorerToolWindowViewModel vm, TestItem testToRun, TestCaseItem caseToRun, CancellationToken token)
        {
            if (token.IsCancellationRequested)
            {
                return;
            }

            var timeout = testToRun.Plan.TimeoutValue;

            caseToRun.Log("Test set execution started" + (timeout == 0 ? "" : $" with {timeout}ms timeout"));
            var watch = new Stopwatch();

            watch.Start();
            try
            {
                // --- Set the test case machine context
                caseToRun.Plan.MachineContext = this;

                // --- Execute arrange
                ExecuteArrange(caseToRun.Plan, testToRun.Plan.ArrangeAssignments);
                ReportTimeDetail("Arrange:", caseToRun, watch);

                // --- Execute the test code
                var success = await InvokeCodeAsync(caseToRun, testToRun.Plan.Act, timeout, token, watch);

                ReportTimeDetail("Act:", caseToRun, watch);

                if (success)
                {
                    // --- Execute assertions
                    if (ExecuteAssert(caseToRun.Plan, testToRun.Plan.Assertions, out var stopIndex))
                    {
                        caseToRun.State = TestState.Success;
                    }
                    else
                    {
                        caseToRun.State = TestState.Failed;
                        caseToRun.Log($"Assertion #{stopIndex} failed.", LogEntryType.Fail);
                    }
                    ReportTimeDetail("Assert:", caseToRun, watch);
                }
            }
            catch (Exception ex)
            {
                HandleException(caseToRun, ex);
            }
            finally
            {
                vm.UpdateCounters();
                caseToRun.Log($"Test execution completed in {watch.Elapsed.TotalSeconds:####0.####} seconds");
                ReportTestResult(caseToRun);
            }
        }
コード例 #4
0
 private bool IsNewTestCaseItemCorrect(TestCaseItem item, string correctText)
 {
     return(item.Text == correctText && item.Status == Status.None && item.Result == Result.Unknown);
 }