public void TestActionWhenContextIsATableProcessesActions()
        {
            var action = new Mock<IAction>(MockBehavior.Strict);
            var items = new List<IValidationComparer> { new StartsWithComparer() }.AsReadOnly();

            var actionRepository = new Mock<IActionRepository>(MockBehavior.Strict);
            actionRepository.Setup(a => a.GetComparisonTypes()).Returns(items);

            var tokenManager = new Mock<ITokenManager>(MockBehavior.Strict);
            tokenManager.Setup(t => t.GetToken("foo")).Returns("foo");

            var preAction = new ValidationTablePreAction(actionRepository.Object, tokenManager.Object);

            var table = new ValidationTable();
            table.AddValidation("My Field", "starts with", "foo");

            var context = new TableContext(table);
            preAction.PerformPreAction(action.Object, context);

            var validation = table.Validations.First();
            Assert.AreEqual("myfield", validation.FieldName);
            Assert.AreEqual("foo", validation.ComparisonValue);
            Assert.IsNotNull(validation.Comparer);
            Assert.IsInstanceOfType(validation.Comparer, typeof(StartsWithComparer));

            action.VerifyAll();
            actionRepository.VerifyAll();
            tokenManager.VerifyAll();
        }
        public void TestActionWhenContextIsNotATableExits()
        {
            var action = new Mock<IAction>(MockBehavior.Strict);
            var actionRepository = new Mock<IActionRepository>(MockBehavior.Strict);
            var tokenManager = new Mock<ITokenManager>(MockBehavior.Strict);

            var preAction = new ValidationTablePreAction(actionRepository.Object, tokenManager.Object);

            var context = new ActionContext("myproperty");

            preAction.PerformPreAction(action.Object, context);

            action.VerifyAll();
            actionRepository.VerifyAll();
            tokenManager.VerifyAll();
        }