當前位置: 首頁>>代碼示例>>C#>>正文


C# Table.ToValidationTable方法代碼示例

本文整理匯總了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));
        }
開發者ID:kristerbone,項目名稱:specbind,代碼行數:8,代碼來源:ValidationTableExtensionsFixture.cs

示例2: TestToValidationTableWhenValueColumnIsMissingThrowsException

        public void TestToValidationTableWhenValueColumnIsMissingThrowsException()
        {
            var table = new Table("Field", "Rule");

            ExceptionHelper.SetupForException<ElementExecuteException>(
                () => table.ToValidationTable(),
                ex => Assert.AreEqual(InvalidColumnErrorMessage, ex.Message));
        }
開發者ID:kristerbone,項目名稱:specbind,代碼行數:8,代碼來源:ValidationTableExtensionsFixture.cs

示例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);
        }
開發者ID:kristerbone,項目名稱:specbind,代碼行數:12,代碼來源:SelectionSteps.cs

示例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();
        }
開發者ID:DavidPx,項目名稱:specbind,代碼行數:8,代碼來源:DataSteps.cs

示例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();
        }
開發者ID:DavidPx,項目名稱:specbind,代碼行數:40,代碼來源:DataSteps.cs

示例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);
        }
開發者ID:kristerbone,項目名稱:specbind,代碼行數:15,代碼來源:ValidationTableExtensionsFixture.cs


注:本文中的TechTalk.SpecFlow.Table.ToValidationTable方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。