Exemplo n.º 1
0
		public void TestClickItemFieldDoesNotExist()
		{
			var locator = new Mock<IElementLocator>(MockBehavior.Strict);
			locator.Setup(p => p.GetElement("doesnotexist")).Throws(new ElementExecuteException("Cannot find item"));

			var buttonClickAction = new ButtonClickAction
			                        {
				                        ElementLocator = locator.Object
			                        };

		    var context = new ActionContext("doesnotexist");

			ExceptionHelper.SetupForException<ElementExecuteException>(
				() => buttonClickAction.Execute(context), e => locator.VerifyAll());
		}
		public void TestClickItemSuccess()
		{
			var propData = new Mock<IPropertyData>(MockBehavior.Strict);
			propData.Setup(p => p.ClickElement());

			var locator = new Mock<IElementLocator>(MockBehavior.Strict);
			locator.Setup(p => p.GetElement("myproperty")).Returns(propData.Object);

			var buttonClickAction = new ButtonClickAction
			{
				ElementLocator = locator.Object
			};

            var context = new ActionContext("myproperty");
            var result = buttonClickAction.Execute(context);

			Assert.AreEqual(true, result.Success);

			locator.VerifyAll();
			propData.VerifyAll();
		}
Exemplo n.º 3
0
		public void TestGetActionName()
		{
			var buttonClickAction = new ButtonClickAction();

            Assert.AreEqual("ButtonClickAction", buttonClickAction.Name);
		}