public void ThenIgnoredScenarioOutlineIsSetToInconclusive()
        {
            var results = ParseResultsFile();

            var feature = new Feature {
                Name = "Example With Ignored Scenario Outline"
            };
            var scenarioOutline = new ScenarioOutline {
                Name = "Add two numbers", Feature = feature
            };

            scenarioOutline.Steps = new List <Step>();

            var examples = new ExampleTable();

            examples.HeaderRow = new TableRow();
            examples.HeaderRow.Cells.Add("TestCase");
            var row = new TableRowWithTestResult();

            row.Cells.Add("1");
            examples.DataRows = new List <TableRow>();
            examples.DataRows.Add(row);

            scenarioOutline.Examples = new List <Example>();
            scenarioOutline.Examples.Add(new Example()
            {
                TableArgument = examples
            });

            var matchedExampleResult = results.GetExampleResult(scenarioOutline, new string[] { "1" });

            Check.That(matchedExampleResult).IsEqualTo(TestResult.Inconclusive);
        }
Exemple #2
0
        private void AddRowWithResult(Table table, string[] data, TestResult result)
        {
            var tableRowWithResult = new TableRowWithTestResult(data)
            {
                Result = result
            };

            table.DataRows.Add(tableRowWithResult);
        }
        public JsonTableRow MapwWithTestResult(TableRowWithTestResult tableRow)
        {
            if (tableRow == null)
            {
                return(null);
            }

            return(new JsonTableRowWithTestResult(tableRow.Cells.ToArray(), this.testResultMapper.Map(tableRow.Result)));
        }
        public void Map_TableRowWithTestResultsWithRows_ReturnsObjectWithStrings()
        {
            var tableRow = new TableRowWithTestResult("first string", "second string", "third string");
            var mapper   = CreateTableRowMapper();
            var actual   = mapper.MapwWithTestResult(tableRow) as JsonTableRowWithTestResult;

            Check.That(actual != null);
            Check.That(actual).Contains("first string", "second string", "third string");
            Check.That(actual.Result.WasExecuted).IsFalse();
            Check.That(actual.Result.WasSuccessful).IsFalse();
        }
        public void Map_TableRow_ReturnsObject()
        {
            var tableRow = new TableRowWithTestResult {
                Result = TestResult.Passed
            };
            var mapper = CreateTableRowMapper();

            var actual = mapper.Map(tableRow) as JsonTableRowWithTestResult;

            Check.That(actual == null);
        }
        public void Map_TableRowWithResult_ReturnsObjectWithResult()
        {
            var tableRow = new TableRowWithTestResult {
                Result = TestResult.Passed
            };
            var mapper = CreateTableRowMapper();
            var actual = mapper.MapwWithTestResult(tableRow) as JsonTableRowWithTestResult;

            Check.That(actual != null);
            Check.That(actual.Result.WasExecuted).IsTrue();
            Check.That(actual.Result.WasSuccessful).IsTrue();
        }
        public void Map_TableRowWithTestResult_ConvertsToJsonTableRowWithTestResult()
        {
            var tableRow = new TableRowWithTestResult {
                Result = TestResult.Passed
            };
            var mapper       = CreateTableRowMapper();
            var jsonTableRow = mapper.MapwWithTestResult(tableRow) as JsonTableRowWithTestResult;

            Check.That(jsonTableRow != null);

            Check.That(jsonTableRow.Result.WasExecuted).IsEqualTo(true);
            Check.That(jsonTableRow.Result.WasSuccessful).IsEqualTo(true);
        }
        public void ThenMatchWillBeFoundEvenIfACarriageReturnWasFoundInValueField()
        {
            var results = ParseResultsFile();

            var feature = new Feature {
                Name = "Example With Empty Value"
            };
            var scenarioOutline = new ScenarioOutline {
                Name = "Testing test", Feature = feature
            };

            scenarioOutline.Steps = new List <Step>();

            var examples = new ExampleTable();

            examples.HeaderRow = new TableRow();
            examples.HeaderRow.Cells.Add("result1");
            examples.HeaderRow.Cells.Add("result2");
            examples.HeaderRow.Cells.Add("result3");
            var row = new TableRowWithTestResult();

            row.Cells.Add("1");
            row.Cells.Add("2");
            row.Cells.Add("3");
            examples.DataRows = new List <TableRow>();
            examples.DataRows.Add(row);
            row = new TableRowWithTestResult();
            row.Cells.Add("1");
            row.Cells.Add("");
            row.Cells.Add("4");
            examples.DataRows.Add(row);

            scenarioOutline.Examples = new List <Example>();
            scenarioOutline.Examples.Add(new Example()
            {
                TableArgument = examples
            });

            var actualResult = results.GetExampleResult(scenarioOutline, new string[] { "1", "", "4" });
        }