public void TestGivenNavigateToPageStepWithArguments() { var testPage = new Mock<IPage>(); var pipelineService = new Mock<IActionPipelineService>(MockBehavior.Strict); pipelineService.Setup(p => p.PerformAction<PageNavigationAction>( null, It.Is<PageNavigationAction.PageNavigationActionContext>(c => c.PropertyName == "mypage" && c.PageAction == PageNavigationAction.PageAction.NavigateToPage && c.PageArguments != null && c.PageArguments.Count == 2))) .Returns(ActionResult.Successful(testPage.Object)); var scenarioContext = new Mock<IScenarioContextHelper>(MockBehavior.Strict); scenarioContext.Setup(s => s.SetValue(It.IsAny<IPage>(), PageStepBase.CurrentPageKey)); var tokenManager = new Mock<ITokenManager>(MockBehavior.Strict); tokenManager.Setup(t => t.GetToken(It.IsAny<string>())).Returns<string>(s => s); var steps = new PageNavigationSteps(scenarioContext.Object, pipelineService.Object, tokenManager.Object); var table = new Table("Id", "Part"); table.AddRow("1", "A"); steps.GivenNavigateToPageWithArgumentsStep("mypage", table); scenarioContext.VerifyAll(); pipelineService.VerifyAll(); }
public void TestGivenNavigateToPageStepWithArguments() { var testPage = new Mock <IPage>(); var pipelineService = new Mock <IActionPipelineService>(MockBehavior.Strict); pipelineService.Setup(p => p.PerformAction <PageNavigationAction>( null, It.Is <PageNavigationAction.PageNavigationActionContext>(c => c.PropertyName == "mypage" && c.PageAction == PageNavigationAction.PageAction.NavigateToPage && c.PageArguments != null && c.PageArguments.Count == 2))) .Returns(ActionResult.Successful(testPage.Object)); var scenarioContext = new Mock <IScenarioContextHelper>(MockBehavior.Strict); scenarioContext.Setup(s => s.SetValue(It.IsAny <IPage>(), PageStepBase.CurrentPageKey)); var tokenManager = new Mock <ITokenManager>(MockBehavior.Strict); tokenManager.Setup(t => t.GetToken(It.IsAny <string>())).Returns <string>(s => s); var steps = new PageNavigationSteps(scenarioContext.Object, pipelineService.Object, tokenManager.Object); var table = new Table("Id", "Part"); table.AddRow("1", "A"); steps.GivenNavigateToPageWithArgumentsStep("mypage", table); scenarioContext.VerifyAll(); pipelineService.VerifyAll(); }
public void TestGivenNavigateToPageStepWithArguments() { var pipelineService = new Mock<IActionPipelineService>(MockBehavior.Strict); var testPage = new Mock<IPage>(); var browser = new Mock<IBrowser>(MockBehavior.Strict); browser.Setup(b => b.GoToPage(typeof(TestBase), It.Is<IDictionary<string, string>>(d => d.Count == 2))).Returns(testPage.Object); var pageMapper = new Mock<IPageMapper>(MockBehavior.Strict); pageMapper.Setup(p => p.GetTypeFromName("mypage")).Returns(typeof(TestBase)); var scenarioContext = new Mock<IScenarioContextHelper>(MockBehavior.Strict); scenarioContext.Setup(s => s.SetValue(It.IsAny<IPage>(), PageStepBase.CurrentPageKey)); var steps = new PageNavigationSteps(browser.Object, pageMapper.Object, scenarioContext.Object, pipelineService.Object); var table = new Table("Id", "Part"); table.AddRow("1", "A"); steps.GivenNavigateToPageWithArgumentsStep("mypage", table); browser.VerifyAll(); pageMapper.VerifyAll(); scenarioContext.VerifyAll(); }