public void ThenCanFormatScenarioOutlineWithMissingNameCorrectly() { var table = new Table { HeaderRow = new TableRow("Var1", "Var2", "Var3", "Var4"), DataRows = new List<TableRow>(new[] { new TableRow("1", "2", "3", "4"), new TableRow("5", "6", "7", "8") }) }; var example = new Example { Name = "Some examples", Description = "An example", TableArgument = table }; var examples = new List<Example>(); examples.Add(example); var scenarioOutline = new ScenarioOutline { Description = "We need to make sure that scenario outlines work properly", Examples = examples }; var htmlScenarioOutlineFormatter = Container.Resolve<HtmlScenarioOutlineFormatter>(); var output = htmlScenarioOutlineFormatter.Format(scenarioOutline, 0); Check.That(output).ContainsGherkinScenario(); Check.That(output).ContainsGherkinTable(); }
public Example GetResult() { var example = new Example(); example.Name = this.name; example.Description = this.description; example.TableArgument = this.tableBuilder.GetResult(); return example; }
public void Map_AnExampleWithDescription_ReturnsAJsonExampleWithName() { var example = new Example { Description = "Some description" }; var mapper = CreateMapper(); var actual = mapper.Map(example); Check.That(actual.Description).IsEqualTo("Some description"); }
public void Map_AnExampleWithName_ReturnsAJsonExampleWithName() { var example = new Example { Name = "Some name"}; var mapper = CreateMapper(); var actual = mapper.Map(example); Check.That(actual.Name).IsEqualTo("Some name"); }
public void Map_AnExample_ReturnsAJsonExample() { var example = new Example(); var mapper = CreateMapper(); var actual = mapper.Map(example); Check.That(actual).IsNotNull(); }
public JsonExample Map(Example example) { if (example == null) { return null; } return new JsonExample { Name = example.Name, Description = example.Description, TableArgument = this.tableMapper.Map(example.TableArgument) }; }
public void ThenSingleScenarioOutlineWithStepsAddedSuccessfully() { var excelScenarioFormatter = Container.Resolve<ExcelScenarioOutlineFormatter>(); var exampleTable = new Table(); exampleTable.HeaderRow = new TableRow("Var1", "Var2", "Var3", "Var4"); exampleTable.DataRows = new List<TableRow>(new[] {new TableRow("1", "2", "3", "4"), new TableRow("5", "6", "7", "8")}); var example = new Example {Name = "Examples", Description = string.Empty, TableArgument = exampleTable}; var examples = new List<Example>(); examples.Add(example); var scenarioOutline = new ScenarioOutline { Name = "Test Feature", Description = "In order to test this feature,\nAs a developer\nI want to test this feature", Examples = examples }; var given = new Step {NativeKeyword = "Given", Name = "a precondition"}; var when = new Step {NativeKeyword = "When", Name = "an event occurs"}; var then = new Step {NativeKeyword = "Then", Name = "a postcondition"}; scenarioOutline.Steps = new List<Step>(new[] {given, when, then}); using (var workbook = new XLWorkbook()) { IXLWorksheet worksheet = workbook.AddWorksheet("SHEET1"); int row = 3; excelScenarioFormatter.Format(worksheet, scenarioOutline, ref row); Check.That(worksheet.Cell("B3").Value).IsEqualTo(scenarioOutline.Name); Check.That(worksheet.Cell("C4").Value).IsEqualTo(scenarioOutline.Description); Check.That(worksheet.Cell("B9").Value).IsEqualTo("Examples"); Check.That(worksheet.Cell("D10").Value).IsEqualTo("Var1"); Check.That(worksheet.Cell("E10").Value).IsEqualTo("Var2"); Check.That(worksheet.Cell("F10").Value).IsEqualTo("Var3"); Check.That(worksheet.Cell("G10").Value).IsEqualTo("Var4"); Check.That(worksheet.Cell("D11").Value).IsEqualTo(1.0); Check.That(worksheet.Cell("E11").Value).IsEqualTo(2.0); Check.That(worksheet.Cell("F11").Value).IsEqualTo(3.0); Check.That(worksheet.Cell("G11").Value).IsEqualTo(4.0); Check.That(worksheet.Cell("D12").Value).IsEqualTo(5.0); Check.That(worksheet.Cell("E12").Value).IsEqualTo(6.0); Check.That(worksheet.Cell("F12").Value).IsEqualTo(7.0); Check.That(worksheet.Cell("G12").Value).IsEqualTo(8.0); Check.That(row).IsEqualTo(13); } }
public void ThenSingleScenarioOutlineAddedSuccessfully() { var excelScenarioFormatter = Container.Resolve<ExcelScenarioOutlineFormatter>(); var exampleTable = new Table(); exampleTable.HeaderRow = new TableRow("Var1", "Var2", "Var3", "Var4"); exampleTable.DataRows = new List<TableRow>(new[] {new TableRow("1", "2", "3", "4"), new TableRow("5", "6", "7", "8")}); var example = new Example {Name = "Examples", Description = string.Empty, TableArgument = exampleTable}; var examples = new List<Example>(); examples.Add(example); var scenarioOutline = new ScenarioOutline { Name = "Test Feature", Description = "In order to test this feature,\nAs a developer\nI want to test this feature", Examples = examples }; using (var workbook = new XLWorkbook()) { IXLWorksheet worksheet = workbook.AddWorksheet("SHEET1"); int row = 3; excelScenarioFormatter.Format(worksheet, scenarioOutline, ref row); Check.That(worksheet.Cell("B3").Value).IsEqualTo(scenarioOutline.Name); Check.That(worksheet.Cell("C4").Value).IsEqualTo(scenarioOutline.Description); Check.That(worksheet.Cell("B6").Value).IsEqualTo("Examples"); Check.That(worksheet.Cell("D7").Value).IsEqualTo("Var1"); Check.That(worksheet.Cell("E7").Value).IsEqualTo("Var2"); Check.That(worksheet.Cell("F7").Value).IsEqualTo("Var3"); Check.That(worksheet.Cell("G7").Value).IsEqualTo("Var4"); Check.That(worksheet.Cell("D8").Value).IsEqualTo(1.0); Check.That(worksheet.Cell("E8").Value).IsEqualTo(2.0); Check.That(worksheet.Cell("F8").Value).IsEqualTo(3.0); Check.That(worksheet.Cell("G8").Value).IsEqualTo(4.0); Check.That(worksheet.Cell("D9").Value).IsEqualTo(5.0); Check.That(worksheet.Cell("E9").Value).IsEqualTo(6.0); Check.That(worksheet.Cell("F9").Value).IsEqualTo(7.0); Check.That(worksheet.Cell("G9").Value).IsEqualTo(8.0); Check.That(row).IsEqualTo(10); } }
public void AddExample(Example example) { this.examples.Add(example); }
public void ThenCanFormatScenarioOutlineWithMissingTableFromExampleCorrectly() { var example = new Example { Name = "Some examples", Description = "An example" }; var examples = new List<Example>(); examples.Add(example); var scenarioOutline = new ScenarioOutline { Name = "Testing a scenario outline", Description = "We need to make sure that scenario outlines work properly", Examples = examples }; var htmlScenarioOutlineFormatter = Container.Resolve<HtmlScenarioOutlineFormatter>(); var output = htmlScenarioOutlineFormatter.Format(scenarioOutline, 0); Check.That(output).ContainsGherkinScenario(); Check.That(output).Not.ContainsGherkinTable(); }
public void Map_AnExampleWithTableArgument_ReturnsAJsonExampleWithTableArgument() { var example = new Example { TableArgument = new Table { HeaderRow = new TableRow("Placeholder 1", "Placeholder 2") } }; var mapper = CreateMapper(); var actual = mapper.Map(example); Check.That(actual.TableArgument.HeaderRow).ContainsExactly("Placeholder 1", "Placeholder 2"); }