コード例 #1
0
        public void TestThenISeeComboBoxContainsStepContainsExactlyItems()
        {
            var testPage = new Mock <IPage>();

            var pipelineService = new Mock <IActionPipelineService>(MockBehavior.Strict);

            pipelineService.Setup(p => p.PerformAction <ValidateComboBoxAction>(
                                      testPage.Object,
                                      It.Is <ValidateComboBoxAction.ValidateComboBoxContext>(
                                          c => c.PropertyName == "myfield" && c.ComparisonType == ComboComparisonType.ContainsExactly && c.Items.Count == 1)))
            .Returns(ActionResult.Successful());

            var scenarioContext = new Mock <IScenarioContextHelper>(MockBehavior.Strict);

            scenarioContext.Setup(s => s.GetValue <IPage>(PageStepBase.CurrentPageKey)).Returns(testPage.Object);

            var steps = new DataSteps(scenarioContext.Object, pipelineService.Object);

            var table = new Table("Text");

            table.AddRow(new Dictionary <string, string>
            {
                { "Text", "Something Cool" }
            });

            steps.ThenISeeComboBoxContainsStep("myfield", "contains exactly", table);

            scenarioContext.VerifyAll();
            pipelineService.VerifyAll();
        }
コード例 #2
0
ファイル: DataStepsFixture.cs プロジェクト: CarlHA/specbind
        public void TestThenISeeComboBoxContainsStepHasInvalidTable()
        {
            var pipelineService = new Mock <IActionPipelineService>(MockBehavior.Strict);
            var scenarioContext = new Mock <IScenarioContextHelper>(MockBehavior.Strict);

            var steps = new DataSteps(scenarioContext.Object, pipelineService.Object);

            var table = new Table("Item");

            table.AddRow(new Dictionary <string, string>
            {
                { "Item", "Something Cool" }
            });

            Assert.Throws <ElementExecuteException>(() =>
                                                    ExceptionHelper.SetupForException <ElementExecuteException>(
                                                        () => steps.ThenISeeComboBoxContainsStep("myfield", "contains", table),
                                                        ex =>
            {
                Assert.IsTrue(ex.Message.StartsWith("A table must be specified for this step"));

                scenarioContext.VerifyAll();
                pipelineService.VerifyAll();
            }));
        }
コード例 #3
0
        public void TestThenISeeComboBoxContainsStepHasNoTable()
        {
            var pipelineService = new Mock <IActionPipelineService>(MockBehavior.Strict);
            var scenarioContext = new Mock <IScenarioContextHelper>(MockBehavior.Strict);

            var steps = new DataSteps(scenarioContext.Object, pipelineService.Object);

            steps.ThenISeeComboBoxContainsStep("myfield", "contains", null);

            scenarioContext.VerifyAll();
            pipelineService.VerifyAll();
        }