コード例 #1
0
        public void ShowAssertion(AssertionInfo assertion)
        {
//            var builder = new StringBuilder();
//            foreach (var para in _function.Paras)
//            {
//                para.Value = assertion.InputValues[_function.Paras.IndexOf(para)];
//            }
//
//            builder.Clear();
//            builder.Append(
//                $"value(s): {string.Join(" ", assertion.InputValues.Select(v => v).ToArray())} |  execution path: {_function.ExecutionPath} | result: {_function.Result}");
//            builder.Append(Environment.NewLine);
//            txtResult.AppendText(builder.ToString());
//            txtResult.ScrollToCaret();
        }
コード例 #2
0
        private TestSuiteInfo GetTestSuiteInfoFromTestSuiteFile(string filePath)
        {
            var       testSuite = new TestSuiteInfo();
            XDocument xdoc;

            try
            {
                xdoc = XDocument.Load(filePath);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            testSuite.Name   = xdoc.XPathSelectElement("/TestSuite/Name")?.Value;
            testSuite.Target = xdoc.XPathSelectElement("/TestSuite/Target")?.Value;

            foreach (var testcaseElement in xdoc.XPathSelectElements("/TestSuite/TestCases/TestCase"))
            {
                var testCase = new TestCaseInfo {
                    Id = testcaseElement.Attribute("ID")?.Value
                };

                foreach (var assertionElement in testcaseElement.XPathSelectElements("Assertions/Assertion"))
                {
                    var assertion = new AssertionInfo
                    {
                        Id          = assertionElement.Attribute("ID")?.Value,
                        InputValues = assertionElement.XPathSelectElements("InputValues/InputValue")
                                      .Select(v => Convert.ToDouble(v.Value)).ToList(),
                        ExpectedOutput = assertionElement.XPathSelectElement("ExpectedOutput")?.Value,
                        ActualOutput   = assertionElement.XPathSelectElement("ActualOutput")?.Value,
                        Result         = assertionElement.XPathSelectElement("Result")?.Value
                    };
                    testCase.Assertions.Add(assertion);
                }

                testSuite.TestCases.Add(testCase);
            }

            return(testSuite);
        }
コード例 #3
0
 public static bool IsAssertionInfoShouldProcessBeforeExecutionStart(AssertionInfo assertionInfo)
 {
     return(assertionInfo.OperatorName == AssertionOperatorNames.AssignTo ||
            assertionInfo.OperatorName == AssertionOperatorNames.AssignToVariable);
 }