public void TestFunctionForm() { MessageBox.Show("Enter 'CP.1.4 Test' in the Name field"); R2Function function = new R2Function(); FunctionForm form = new FunctionForm(); form.Show(function); Assert.AreEqual(R2Const.ST_FUNCTION, function.Stereotype); Assert.AreEqual("CP.1.4", function.FunctionId); Assert.AreEqual("CP.1.4", function.GetAlignId()); Assert.AreEqual("CP.1.4", function.GetExtId()); Assert.IsNull(function.RefId); Assert.IsNull(function.Id); Assert.AreEqual("CP.1.4 Test", function.Name); Assert.AreEqual("", function.Description); Assert.AreEqual("", function.ChangeNote); Assert.IsFalse(function.IsCompilerInstruction); Assert.IsNull(function.BaseElement); }
public void TestCIFunctionForm() { R2Function function = new R2Function() { FunctionId = "CP.1.4", Name = "CP.1.4 Test", ChangeNote = "CI ChangeNote" }; function.IsCompilerInstruction = true; function.BaseElement = new R2Function(); FunctionForm form = new FunctionForm(); form.Show(function); Assert.AreEqual(R2Const.ST_FUNCTION, function.Stereotype); Assert.AreEqual("CP.1.4", function.FunctionId); Assert.AreEqual("CP.1.4", function.GetAlignId()); Assert.AreEqual("CP.1.4", function.GetExtId()); Assert.IsNull(function.RefId); Assert.IsNull(function.Id); Assert.AreEqual("CP.1.4 Test", function.Name); Assert.AreEqual("", function.Description); Assert.AreEqual("", function.ChangeNote); Assert.IsFalse(function.IsCompilerInstruction); Assert.IsNull(function.BaseElement); }
private void LoadDummyProfile(int columnNumber, DataGridViewCellStyle cellStyle) { R2Model model = new R2Model { Name = "Dummy" }; modelsDataGridView.Columns[columnNumber].HeaderText = model.Name; modelsDataGridView.Columns[columnNumber].Tag = model; R2Section section = new R2Section { SectionId = "CP", IsReadOnly = true }; model.children.Add(section); int rowNumber = getBaseModelRowNumber(section.GetAlignId()); DataGridViewCell sectionCell = modelsDataGridView.Rows[rowNumber].Cells[columnNumber]; sectionCell.Tag = section; sectionCell.Value = string.Format("{0}", section.SectionId); sectionCell.Style = cellStyle; for (int h = 1; h < 3; h++) { R2Function header = new R2Function { FunctionId = string.Format("CP.{0}", h), IsReadOnly = true }; model.children.Add(header); rowNumber = getBaseModelRowNumber(header.GetAlignId()); if (rowNumber == -1) { // Base Model doesnot have this row, add Row at end rowNumber = modelsDataGridView.Rows.Add(); } DataGridViewCell headerCell = modelsDataGridView.Rows[rowNumber].Cells[columnNumber]; headerCell.Tag = header; headerCell.Value = header.FunctionId; headerCell.Style = cellStyle; for (int f = 1; f < 3; f++) { R2Function function = new R2Function { FunctionId = string.Format("CP.{0}.{1}", h, f), IsReadOnly = true }; model.children.Add(function); rowNumber = getBaseModelRowNumber(function.GetAlignId()); if (rowNumber == -1) { // Base Model doesnot have this row, add Row at end rowNumber = modelsDataGridView.Rows.Add(); } DataGridViewCell functionCell = modelsDataGridView.Rows[rowNumber].Cells[columnNumber]; functionCell.Tag = function; functionCell.Value = function.FunctionId; functionCell.Style = cellStyle; for (int c = 1; c < 4; c++) { R2Criterion criterion = new R2Criterion { FunctionId = string.Format("CP.{0}.{1}", h, f), CriterionSeqNo = c, Text = "The system SHALL xyz", Optionality = "SHALL", IsReadOnly = true }; model.children.Add(criterion); criterion.SetRefId(null, string.Format("CP.{0}.{1}", h, f), string.Format("{0}", c + 1)); rowNumber = getBaseModelRowNumber(criterion.GetAlignId()); if (rowNumber == -1) { // Base Model doesnot have this row, add Row at end rowNumber = modelsDataGridView.Rows.Add(); } DataGridViewCell criterionCell = modelsDataGridView.Rows[rowNumber].Cells[columnNumber]; criterionCell.Tag = criterion; criterionCell.Value = string.Format("! {0}", criterion.Name); criterionCell.ToolTipText = criterion.Text; criterionCell.Style = cellStyle; } } } }