Пример #1
0
        public void RaiseIfSomeParameterIsFloat()
        {
            ExitFunction function = new ExitFunction();

            try
            {
                function.Apply(null, new object[] { 1.0 }, null);
                Assert.Fail("Exception expected");
            }
            catch (Exception ex)
            {
                Assert.IsInstanceOfType(ex, typeof(TypeError));
                Assert.AreEqual("'float' object cannot be interpreted as an integer", ex.Message);
            }
        }
Пример #2
0
        public void RaiseMoreThanTwoParameters()
        {
            ExitFunction function = new ExitFunction();

            try
            {
                function.Apply(null, new object[] { 1, 2, 3, 4 }, null);
                Assert.Fail("Exception expected");
            }
            catch (Exception ex)
            {
                Assert.IsInstanceOfType(ex, typeof(TypeError));
                Assert.AreEqual("range expected at most 1 arguments, got 4", ex.Message);
            }
        }