本文整理匯總了C#中TechTalk.SpecFlow.Table.ToValidationTable方法的典型用法代碼示例。如果您正苦於以下問題:C# Table.ToValidationTable方法的具體用法?C# Table.ToValidationTable怎麽用?C# Table.ToValidationTable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類TechTalk.SpecFlow.Table
的用法示例。
在下文中一共展示了Table.ToValidationTable方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: TestToValidationTableWhenTableIsEmptyThrowsException
public void TestToValidationTableWhenTableIsEmptyThrowsException()
{
var table = new Table("Field", "Rule", "Value");
ExceptionHelper.SetupForException<ElementExecuteException>(
() => table.ToValidationTable(),
ex => Assert.AreEqual("The validation table must contain at least one validation row.", ex.Message));
}
示例2: TestToValidationTableWhenValueColumnIsMissingThrowsException
public void TestToValidationTableWhenValueColumnIsMissingThrowsException()
{
var table = new Table("Field", "Rule");
ExceptionHelper.SetupForException<ElementExecuteException>(
() => table.ToValidationTable(),
ex => Assert.AreEqual(InvalidColumnErrorMessage, ex.Message));
}
示例3: GoToListItemWithCriteriaStep
public void GoToListItemWithCriteriaStep(string listName, Table criteriaTable)
{
var page = this.GetPageFromContext();
var validationTable = criteriaTable.ToValidationTable();
var context = new GetListItemByCriteriaAction.ListItemByCriteriaContext(listName.ToLookupKey(), validationTable);
var item = this.actionPipelineService.PerformAction<GetListItemByCriteriaAction>(page, context)
.CheckResult<IPage>();
this.UpdatePageContext(item);
}
示例4: ThenISeeStep
public void ThenISeeStep(Table data)
{
var validations = data.ToValidationTable();
var page = this.GetPageFromContext();
var context = new ValidateItemAction.ValidateItemContext(validations);
this.actionPipelineService.PerformAction<ValidateItemAction>(page, context).CheckResult();
}
示例5: ThenISeeListStep
public void ThenISeeListStep(string fieldName, string rule, Table data)
{
if (data == null || data.RowCount == 0)
{
return;
}
ComparisonType comparisonType;
switch (rule.ToLookupKey())
{
case "exists":
case "contains":
comparisonType = ComparisonType.Contains;
break;
case "doesnotexist":
case "doesnotcontain":
comparisonType = ComparisonType.DoesNotContain;
break;
case "startswith":
comparisonType = ComparisonType.StartsWith;
break;
case "endswith":
comparisonType = ComparisonType.EndsWith;
break;
case "equals":
comparisonType = ComparisonType.Equals;
break;
default:
throw new InvalidOperationException(string.Format("Rule type '{0}' is not supported.", rule));
}
var page = this.GetPageFromContext();
var validations = data.ToValidationTable();
var context = new ValidateListAction.ValidateListContext(fieldName.ToLookupKey(), comparisonType, validations);
this.actionPipelineService.PerformAction<ValidateListAction>(page, context).CheckResult();
}
示例6: TestToValidationTableWhenTableIsPopulatedReturnsValidationTable
public void TestToValidationTableWhenTableIsPopulatedReturnsValidationTable()
{
var table = new Table("Field", "Rule", "Value");
table.AddRow("My Column", "equals", "Foo");
var validationTable = table.ToValidationTable();
Assert.IsNotNull(validationTable);
Assert.AreEqual(1, validationTable.ValidationCount);
var item = validationTable.Validations.First();
Assert.AreEqual("My Column", item.RawFieldName);
Assert.AreEqual("Foo", item.RawComparisonValue);
Assert.AreEqual("equals", item.RawComparisonType);
}