public void Execute_SecondColumnMoveLast_ColumnMoved() { var state = new GenerationState(); state.TestCaseCollection.Scope.Content.Columns.Add("firstColumn"); state.TestCaseCollection.Scope.Content.Columns.Add("secondColumn"); state.TestCaseCollection.Scope.Content.Columns.Add("thirdColumn"); state.TestCaseCollection.Scope.Content.Columns.Add("fourthColumn"); var firstRow = state.TestCaseCollection.Scope.Content.NewRow(); state.TestCaseCollection.Scope.Content.Rows.Add(firstRow); state.TestCaseCollection.Scope.Variables.Add("firstColumn"); state.TestCaseCollection.Scope.Variables.Add("secondColumn"); state.TestCaseCollection.Scope.Variables.Add("thirdColumn"); state.TestCaseCollection.Scope.Variables.Add("fourthColumn"); var action = new MoveCaseAction("secondColumn", int.MaxValue); action.Execute(state); Assert.That(state.TestCaseCollection.Scope.Content.Columns, Has.Count.EqualTo(4)); Assert.That(state.TestCaseCollection.Scope.Variables[0], Is.EqualTo("firstColumn")); Assert.That(state.TestCaseCollection.Scope.Variables[1], Is.EqualTo("thirdColumn")); Assert.That(state.TestCaseCollection.Scope.Variables[2], Is.EqualTo("fourthColumn")); Assert.That(state.TestCaseCollection.Scope.Variables[3], Is.EqualTo("secondColumn")); }
internal void Move(int selectedIndex, int newPosition) { var action = new MoveCaseAction(Variables[VariableSelectedIndex], newPosition); action.Execute(testCaseCollectionManager.CurrentScope); Reload(); VariableSelectedIndex = newPosition; OnPropertyChanged("Variables"); }
public void Execute_SecondColumnMoveRight_ColumnMoved() { var state = new GenerationState(); state.CaseCollection.CurrentScope.Content.Columns.Add("firstColumn"); state.CaseCollection.CurrentScope.Content.Columns.Add("secondColumn"); state.CaseCollection.CurrentScope.Content.Columns.Add("thirdColumn"); state.CaseCollection.CurrentScope.Content.Columns.Add("fourthColumn"); var firstRow = state.CaseCollection.CurrentScope.Content.NewRow(); state.CaseCollection.CurrentScope.Content.Rows.Add(firstRow); var action = new MoveCaseAction("secondColumn", 1); action.Execute(state); Assert.That(state.CaseCollection.CurrentScope.Content.Columns, Has.Count.EqualTo(4)); Assert.That(state.CaseCollection.CurrentScope.Variables.ToArray()[0], Is.EqualTo("firstColumn")); Assert.That(state.CaseCollection.CurrentScope.Variables.ToArray()[1], Is.EqualTo("thirdColumn")); Assert.That(state.CaseCollection.CurrentScope.Variables.ToArray()[2], Is.EqualTo("secondColumn")); Assert.That(state.CaseCollection.CurrentScope.Variables.ToArray()[3], Is.EqualTo("fourthColumn")); }