public void WhenValid()
        {
            Inventor context = new Inventor("Nikola Tesla", new DateTime(1856, 7, 9), "Serbian");
            Dictionary <string, object> vars   = new Dictionary <string, object>();
            ExceptionAction             action = new ExceptionAction();

            try
            {
                action.Execute(true, context, vars, null);
            }
            catch (Exception)
            {
                Assert.Fail("Should not have thrown exception");
            }
        }
        public void WhenInvalidThrowDefaultException()
        {
            Inventor context = new Inventor("Nikola Tesla", new DateTime(1856, 7, 9), "Serbian");
            Dictionary <string, object> vars   = new Dictionary <string, object>();
            ExceptionAction             action = new ExceptionAction();

            try
            {
                action.Execute(false, context, vars, null);
                Assert.Fail("Should have thrown exception");
            }
            catch (ValidationException)
            {
            }
        }
        public void WhenInvalidThrowCustomException()
        {
            Inventor context = new Inventor("Nikola Tesla", new DateTime(1856, 7, 9), "Serbian");
            Dictionary <string, object> vars   = new Dictionary <string, object>();
            ExceptionAction             action = new ExceptionAction("new System.InvalidOperationException('invalid')");

            try
            {
                action.Execute(false, context, vars, null);
                Assert.Fail("Should have thrown exception");
            }
            catch (InvalidOperationException e)
            {
                Assert.AreEqual("invalid", e.Message);
            }
        }