Пример #1
0
        public void AddOneInteger()
        {
            IFunction addf   = new AddIntegerFunction();
            IFunction result = addf.Apply(new ConstantFunction(1));

            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.Arity);
            Assert.IsInstanceOfType(result, typeof(PartialFunction));
            Assert.AreEqual(result, result.Value);
        }
Пример #2
0
        public void AddTwoIntegers()
        {
            IFunction addf   = new AddIntegerFunction();
            IFunction result = addf.Apply(new ConstantFunction(1)).Apply(new ConstantFunction(2));

            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(ConstantFunction));
            Assert.AreEqual(0, result.Arity);

            Assert.AreEqual(3, result.Value);
        }