コード例 #1
0
        public void ShouldCreateAndEvaluateTest()
        {
            DynamicValueTokenReplacementStrategy tokenReplacementStrategy;
            Func <string[], object> value;
            object result;

            value = p => int.Parse(p[0]) + 1;

            tokenReplacementStrategy = new DynamicValueTokenReplacementStrategy(value);

            Assert.IsNotNull(tokenReplacementStrategy);
            Assert.IsNotNull(tokenReplacementStrategy.Method);

            result = tokenReplacementStrategy.Evaluate(new string[] { "10" });

            Assert.IsNotNull(result);
            Assert.AreEqual(11, result);
        }
コード例 #2
0
        public void ShouldCreateAndEvaluateTest()
        {
            DynamicValueTokenReplacementStrategy tokenReplacementStrategy;
            Func <string[], object> value;
            object result;

            value = p => int.Parse(p[0]) + 1;

            // TODO - MOCK THIS
            IDataTypeFascade   mockDataTypeFascade   = new DataTypeFascade();
            IReflectionFascade mockReflectionFascade = new ReflectionFascade(mockDataTypeFascade);

            tokenReplacementStrategy = new DynamicValueTokenReplacementStrategy(mockDataTypeFascade, mockReflectionFascade, value);

            Assert.IsNotNull(tokenReplacementStrategy);
            Assert.IsNotNull(tokenReplacementStrategy.Method);

            result = tokenReplacementStrategy.Evaluate(new string[] { "10" });

            Assert.IsNotNull(result);
            Assert.AreEqual(11, result);
        }