Exemplo n.º 1
0
 /// <summary>
 /// Constructs a <see cref="CellOperand" /> to read runtime values for the specified cell index
 /// via the given accessor object.
 /// </summary>
 /// <param name="recordAccessor">Accessor object to retrieve cell values</param>
 /// <param name="cellIndex">Index of cell to retrieve</param>
 public CellOperand(RecordAccessor recordAccessor, int cellIndex)
 {
     if (recordAccessor == null)
         throw new PledgeRunException(nameof(recordAccessor), "CellOperand requires a RecordAccessor to be specified");
     CellIndex = cellIndex;
     RecordAccessor = recordAccessor;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Constructs a <see cref="CellOperand" /> to read runtime values for the specified cell index
 /// via the given accessor object.
 /// </summary>
 /// <param name="recordAccessor">Accessor object to retrieve cell values</param>
 /// <param name="cellIndex">Index of cell to retrieve</param>
 public CellOperand(RecordAccessor recordAccessor, int cellIndex)
 {
     if (recordAccessor == null)
     {
         throw new PledgeRunException(nameof(recordAccessor), "CellOperand requires a RecordAccessor to be specified");
     }
     CellIndex      = cellIndex;
     RecordAccessor = recordAccessor;
 }
Exemplo n.º 3
0
        private static IOperand CellOperandWithValueAndIndex(string expectedCellValue, int cellIndex)
        {
            var testCell = new Cell {Value = expectedCellValue};

            var mockRecord = new Mock<IRecord>();
            mockRecord.Setup(record => record.Count).Returns(1);
            mockRecord.Setup(record => record[0]).Returns(testCell);

            var accessor = new RecordAccessor {Record = mockRecord.Object};

            return new CellOperand(accessor, cellIndex);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Constructs a new ruleset containing the given rules/
 /// </summary>
 /// <param name="recordAccessor"></param>
 /// <param name="rules"></param>
 public RuleSet(RecordAccessor recordAccessor, IReadOnlyList<IRule> rules)
 {
     RecordAccessor = recordAccessor;
     Rules = rules;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Sets the metadata value of the operand.
 /// </summary>
 /// <param name="metaType">The metadata tag.</param>
 public void SetValueFromMeta(string metaType)
 {
     RecordAccessor.UpdateValueFromMeta(CellIndex, metaType);
 }
Exemplo n.º 6
0
 /// <summary>
 /// Sets the value of the operand.
 /// </summary>
 /// <param name="value">The value.</param>
 public void SetValue(string value)
 {
     RecordAccessor.UpdateValue(CellIndex, value);
 }
Exemplo n.º 7
0
 /// <summary>
 /// Retrieve the raw text value for the operand.
 /// </summary>
 /// <returns></returns>
 public string TextValue()
 {
     return(RecordAccessor.TextValue(CellIndex));
 }