public CellTag AddCell(Cell cell, string tagName) { var child = new CellTag(cell, tagName); Append(child); return child; }
public void write_preview_when_the_cell_value_is_missing_in_the_step() { var cell = Cell.For <string>("name"); var step = new Step(); var tag = new CellTag(cell, step); tag.WritePreview(new TestContext()); tag.Text().ShouldEqual("MISSING"); }
public void write_preview() { var cell = Cell.For <string>("name"); var step = new Step().With("name:Jeremy"); var tag = new CellTag(cell, step); tag.WritePreview(new TestContext()); tag.Text().ShouldEqual("Jeremy"); tag.HasClass(HtmlClasses.INPUT).ShouldBeTrue(); }
public void SetUp() { cell = Cell.For <string>("name"); cell.IsResult = true; step = new Step().With("name:Jeremy"); result = new StepResults(); result.SetActual("name", "Jeremy"); tag = new CellTag(cell, step); tag.WriteResults(result, new TestContext()); }
public void write_preview_when_the_cell_value_is_blank() { var cell = Cell.For <string>("name"); var step = new Step(); step.Set("name", string.Empty); var tag = new CellTag(cell, step); tag.WritePreview(new TestContext()); tag.Text().ShouldEqual(Step.BLANK); }
public void write_preview_when_the_cell_value_is_null_in_the_step() { var cell = Cell.For <string>("name"); var step = new Step(); step.Set("name", null); var tag = new CellTag(cell, step); tag.WritePreview(new TestContext()); tag.Text().ShouldEqual(Step.NULL); }
void dgv_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (_displayedDataRow == null) { return; } DataGridView dgv = sender as DataGridView; if (e.RowIndex < 0 || e.ColumnIndex < 0) { return; } CellTag dbSystemCombination = dgv.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag as CellTag; string cellValue = dgv.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(); //the data-system combination was not available before if (dbSystemCombination == null) //combo was set from n/a (data not applicable for the system) to 'best' or 'x' { //null means that there was never another setting (i.e. the combination is actually new, not just changed back) dbSystemCombination = new CellTag(); dbSystemCombination.SystemID = dgv.Columns[e.ColumnIndex].Tag.ToString(); dbSystemCombination.ChangeState = ChangeStates.added; dbSystemCombination.BestMatch = (cellValue == _comboEntryBestMatch) ? DefPar.Value.YES : DefPar.Value.NO; RowTag dataRow = dgv.Rows[e.RowIndex].Tag as RowTag; dataRow.CellTags.Add(dbSystemCombination.SystemID, dbSystemCombination); dgv.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag = dbSystemCombination; } //the data-system combination was available before else { if (cellValue == _comboEntryNA) //combo was set from 'best' or 'x' to n/a (data not applicable for the system) { if (dbSystemCombination.ChangeState != ChangeStates.added) { dbSystemCombination.ChangeState = ChangeStates.removed; } else //combination was not really available, but preliminary created in this session of the dialog { _displayedDataRow.CellTags.Remove(dbSystemCombination.SystemID); } } else //combo was set to 'x' or 'best' { dbSystemCombination.BestMatch = (cellValue == _comboEntryBestMatch) ? DefPar.Value.YES : dbSystemCombination.BestMatch = DefPar.Value.NO; if (dbSystemCombination.ChangeState != ChangeStates.added) { dbSystemCombination.ChangeState = ChangeStates.changed; //works for x->best, best->x, no matter if changed or unchanged before } } //as well as for n/a->best n/a->x if removed before (i.e. user changed her mind) } }
public void get_header_attribute_off_of_table() { var fixture = new MathFixture(); var sentence = fixture["StartWith"].ToStructure(new FixtureLibrary()).ShouldBeOfType <Sentence>(); Cell cell = sentence.Cells.First(); cell.DefaultValue.ShouldEqual("11"); cell.ToInputCell().DefaultValue.ShouldEqual("11"); var tag = new CellTag(cell, new Step()); tag.MetaData("defaultValue").ShouldEqual("11"); }
public void write_results_when_the_cell_is_just_an_input() { var cell = Cell.For <string>("name"); cell.IsResult = false; var step = new Step().With("name:Jeremy"); var tag = new CellTag(cell, step); tag.WriteResults(new StepResults(), new TestContext()); tag.Text().ShouldEqual("Jeremy"); tag.HasClass(HtmlClasses.INPUT).ShouldBeTrue(); }
void UpdateContentTable(string dataToSelect = "") { dgvSystemDataCombinations.Rows.Clear(); dgvSystemDataCombinations.Columns.Clear(); dgvHHOT.Rows.Clear(); dgvHHOT.Columns.Clear(); DataGridViewRow rowToSelect = null; //add systems to system-dataset-combination table foreach (string systemID in _systemInfo.Keys) { AddSystemToDGV(dgvSystemDataCombinations, systemID); AddSystemToDGV(dgvHHOT, systemID); } //add datasets and whether they are applicable on systems to system-dataset-combination table List <string> dbNamesSorted = (from di in _dataBaseInfo select di.Name + di.ID).ToList(); //add id to be sure to avoid missing any dataset, because of duplicate name dbNamesSorted.Sort(); foreach (string dbNameSorted in dbNamesSorted) { RowTag dataBaseInfo = (from di in _dataBaseInfo where di.Name + di.ID == dbNameSorted select di).First(); if (dataBaseInfo.ChangeState == ChangeStates.removed) { continue; } DataGridView dgv = dataBaseInfo.Name.ToLower().Contains("hhot") ? dgvHHOT : dgvSystemDataCombinations; int rowIndex = dgv.Rows.Add(); DataGridViewRow dgvRow = dgv.Rows[rowIndex]; dgvRow.Tag = dataBaseInfo; dgvRow.HeaderCell.Value = dataBaseInfo.Name; if (dataBaseInfo.ID == dataToSelect) { rowToSelect = dgvRow; } if (dataBaseInfo.Private == DefPar.Value.YES) { dgvRow.HeaderCell.Style.ForeColor = _privateForeColor; dgvRow.HeaderCell.Style.SelectionForeColor = _privateForeColor; dgvRow.HeaderCell.Style.SelectionBackColor = _privateBackColor; // just to make the red fore colour more visible } for (int columnIndex = 0; columnIndex < dgv.Columns.Count; ++columnIndex) { dgvRow.Cells[columnIndex].Value = _comboEntryNA; string systemID = dgv.Columns[columnIndex].Tag.ToString(); if (dataBaseInfo.CellTags.Keys.Contains(systemID)) { CellTag cellTag = dataBaseInfo.CellTags[systemID]; if (cellTag.BestMatch == DefPar.Value.YES) { dgvRow.Cells[columnIndex].Value = _comboEntryBestMatch; } else { dgvRow.Cells[columnIndex].Value = _comboEntryApplicable; } dgvRow.Cells[columnIndex].Tag = cellTag; } } } //display attributes of first or newly added dataset if (dataToSelect == string.Empty && GetSelectedDGV().Rows.Count > 0) { rowToSelect = GetSelectedDGV().Rows[0]; } if (rowToSelect != null) { tabControl.SelectedTab = rowToSelect.DataGridView.Name == dgvHHOT.Name ? tabHHOT : tabGeneral; rowToSelect.Selected = true; } }
public void when_writing_the_validation_for_a_float_cell() { CellTag tag = forCell(Cell.For <float>("num")); tag.ShouldHaveClass(GrammarConstants.NUMBER).ShouldHaveAtt(GrammarConstants.MAX_LENGTH, "19"); }