public void Map_TableRowWithCells_ConvertsToJsonTableRow()
        {
            var tableRow = new TableRow { Cells = { "cell 1", "cell 2" } };

            var mapper = CreateMapper();

            var jsonTableRow = mapper.Map(tableRow);

            Check.That(jsonTableRow).ContainsExactly("cell 1", "cell 2");
        }
Esempio n. 2
0
        public void TableRowWithCells_Always_ConvertsToJsonTableRow()
        {
            var tableRow = new TableRow { Cells = { "cell 1", "cell 2" } };

            var jsonMapper = new JsonMapper();

            JsonTableRow jsonTableRow = jsonMapper.Map(tableRow);

            Check.That(jsonTableRow).ContainsExactly("cell 1", "cell 2");
        }
        public void Map_TableRowWithRows_ReturnsObjectWithStrings()
        {
            var tableRow = new TableRow("first string", "second string", "third string");

            var mapper = CreateMapper();

            var actual = mapper.Map(tableRow);

            Check.That(actual).ContainsExactly("first string", "second string", "third string");
        }
Esempio n. 4
0
        public void TableRowWithTestResult_Always_ConvertsToJsonTableRowWithTestResult()
        {
            var tableRow = new TableRow { Result = TestResult.Passed };

            var jsonMapper = new JsonMapper();

            JsonTableRow jsonTableRow = jsonMapper.Map(tableRow);

            Check.That(jsonTableRow.Result.WasExecuted).IsEqualTo(true);
            Check.That(jsonTableRow.Result.WasSuccessful).IsEqualTo(true);
        }
        public void Map_TableRowWithTestResult_ConvertsToJsonTableRowWithTestResult()
        {
            var tableRow = new TableRow { Result = TestResult.Passed };

            var mapper = CreateMapper();

            var jsonTableRow = mapper.Map(tableRow);

            Check.That(jsonTableRow.Result.WasExecuted).IsEqualTo(true);
            Check.That(jsonTableRow.Result.WasSuccessful).IsEqualTo(true);
        }
        public void Map_TableRowWithResult_ReturnsObjectWithResult()
        {
            var tableRow = new TableRow { Result = TestResult.Passed };

            var mapper = CreateMapper();

            var actual = mapper.Map(tableRow);

            Check.That(actual.Result.WasExecuted).IsTrue();
            Check.That(actual.Result.WasSuccessful).IsTrue();
        }
        public JsonTableRow Map(TableRow tableRow)
        {
            if (tableRow == null)
            {
                return null;
            }

            return new JsonTableRow(tableRow.Cells.ToArray())
            {
                Result = this.testResultMapper.Map(tableRow.Result)
            };
        }
Esempio n. 8
0
      private XElement FormatRow(TableRow row, ScenarioOutline scenarioOutline, bool includeResults)
      {
        var formattedCells = row.Select(
          cell =>
          new XElement(
            this.xmlns + "td",
            cell)).ToList();

        if (includeResults && scenarioOutline != null)
        {
          formattedCells.Add(
            new XElement(this.xmlns + "td", this.htmlImageResultFormatter.Format(scenarioOutline, row.ToArray())));
        }

        var result = new XElement(this.xmlns + "tr");

        foreach (var cell in formattedCells)
        {
          result.Add(cell);
        }

        return result;
      }
Esempio n. 9
0
 public JsonTableRow Map(TableRow tableRow)
 {
     return this.mapper.Map<JsonTableRow>(tableRow);
 }
Esempio n. 10
0
 public TableBuilder()
 {
     this.hasHeader = false;
     this.header = new TableRow();
     this.cells = new List<TableRow>();
 }