public void Execute_VectorAndCellsWithArray_NoSpecificIssue() { var state = new GenerationState(); state.TestCaseCollection.Scope.Content.Columns.Add("firstColumn"); state.TestCaseCollection.Scope.Variables.Add("firstColumn"); var firstRow = state.TestCaseCollection.Scope.Content.NewRow(); firstRow[0] = "firstCell1.1/firstCell1.2"; state.TestCaseCollection.Scope.Content.Rows.Add(firstRow); var secondRow = state.TestCaseCollection.Scope.Content.NewRow(); secondRow[0] = "firstCell2.1/firstCell2.2"; state.TestCaseCollection.Scope.Content.Rows.Add(secondRow); var splitAction = new SplitCaseAction(new[] { "firstColumn" }, "/"); splitAction.Execute(state); var action = new CrossVectorCaseAction(state.TestCaseCollection.CurrentScopeName, "helloColumn", new[] { "Hello" }); action.Execute(state); Assert.That(state.TestCaseCollection.Scope.Content.Columns, Has.Count.EqualTo(2)); Assert.That(state.TestCaseCollection.Scope.Variables[1], Is.EqualTo("helloColumn")); Assert.That(state.TestCaseCollection.Scope.Content.Rows, Has.Count.EqualTo(2)); }
public void Execute_TwoRowsDuplicatedContainingAnArrayWithDifference_TwoRowsRemain() { var state = new GenerationState(); state.TestCaseCollection.Scope.Content.Columns.Add("firstColumn", typeof(object)); state.TestCaseCollection.Scope.Content.Columns.Add("secondColumn", typeof(object)); state.TestCaseCollection.Scope.Variables.Add("firstColumn"); state.TestCaseCollection.Scope.Variables.Add("secondColumn"); var firstRow = state.TestCaseCollection.Scope.Content.NewRow(); firstRow[0] = "firstCell1"; firstRow[1] = "foo/bar"; state.TestCaseCollection.Scope.Content.Rows.Add(firstRow); var secondRow = state.TestCaseCollection.Scope.Content.NewRow(); secondRow[0] = "firstCell1"; secondRow[1] = "foo/bar/x"; state.TestCaseCollection.Scope.Content.Rows.Add(secondRow); var splitAction = new SplitCaseAction(new[] { "secondColumn" }, "/"); splitAction.Execute(state); var action = new FilterDistinctCaseAction(); action.Execute(state); Assert.That(state.TestCaseCollection.Scope.Content.Columns, Has.Count.EqualTo(2)); Assert.That(state.TestCaseCollection.Scope.Content.Rows, Has.Count.EqualTo(2)); Assert.That(state.TestCaseCollection.Scope.Content.Rows[0].ItemArray[0], Is.EqualTo("firstCell1")); Assert.That(state.TestCaseCollection.Scope.Content.Rows[0].ItemArray[1], Has.Member("foo")); Assert.That(state.TestCaseCollection.Scope.Content.Rows[0].ItemArray[1], Has.Member("bar")); Assert.That(state.TestCaseCollection.Scope.Content.Rows[1].ItemArray[1], Has.Member("x")); }
public void Execute_TwoColumnsToSplit_Correct() { var state = new GenerationState(); state.TestCaseCollection.Scope.Content.Columns.Add("initialColumn"); state.TestCaseCollection.Scope.Content.Columns.Add("otherColumn"); state.TestCaseCollection.Scope.Content.Columns.Add("thirdColumn"); state.TestCaseCollection.Scope.Variables.Add("initialColumn"); state.TestCaseCollection.Scope.Variables.Add("otherColumn"); state.TestCaseCollection.Scope.Variables.Add("thirdColumn"); var firstRow = state.TestCaseCollection.Scope.Content.NewRow(); firstRow[0] = "a-b-c"; firstRow[1] = "other"; firstRow[2] = "1-2"; state.TestCaseCollection.Scope.Content.Rows.Add(firstRow); var secondRow = state.TestCaseCollection.Scope.Content.NewRow(); secondRow[0] = "a-b"; secondRow[1] = "other"; secondRow[2] = "3-4"; state.TestCaseCollection.Scope.Content.Rows.Add(secondRow); var thirdRow = state.TestCaseCollection.Scope.Content.NewRow(); thirdRow[0] = "a-b-c-d"; thirdRow[1] = "(none)"; thirdRow[2] = "5-6-7-8"; state.TestCaseCollection.Scope.Content.Rows.Add(thirdRow); Assert.That(state.TestCaseCollection.Scope.Content.Rows[0]["initialColumn"], Is.TypeOf <string>()); Assert.That(state.TestCaseCollection.Scope.Content.Rows[0]["thirdColumn"], Is.TypeOf <string>()); var columns = new string[] { "initialColumn", "thirdColumn" }; var action = new SplitCaseAction(columns, "-"); action.Execute(state); var dataTable = state.TestCaseCollection.Scope.Content; Assert.That(dataTable.Columns, Has.Count.EqualTo(3)); Assert.That(dataTable.Rows, Has.Count.EqualTo(3)); Assert.That(dataTable.Rows[0]["otherColumn"], Is.TypeOf <string>()); Assert.That(dataTable.Rows[0]["initialColumn"], Is.TypeOf <string[]>()); Assert.That(dataTable.Rows[0]["thirdColumn"], Is.TypeOf <string[]>()); Assert.That((dataTable.Rows[0]["initialColumn"] as Array).Length, Is.EqualTo(3)); Assert.That((dataTable.Rows[1]["initialColumn"] as Array).Length, Is.EqualTo(2)); Assert.That((dataTable.Rows[2]["initialColumn"] as Array).Length, Is.EqualTo(4)); Assert.That((dataTable.Rows[0]["thirdColumn"] as Array).Length, Is.EqualTo(2)); Assert.That((dataTable.Rows[1]["thirdColumn"] as Array).Length, Is.EqualTo(2)); Assert.That((dataTable.Rows[2]["thirdColumn"] as Array).Length, Is.EqualTo(4)); }