Example #1
0
        public void TestBraceAccess()
        {
            var rootObject = new ServiceExpressionContext(serviceProvider.GetService <IApplicationContext>());
            var context    = new StandardEvaluationContext(rootObject);

            context.AddPropertyAccessor(new ServiceExpressionContextAccessor());
            context.AddPropertyAccessor(new ConfigurationAccessor());
            var sep = new SpelExpressionParser();

            // basic
            var ex = sep.ParseExpression("configuration['my.name']");

            Assert.Equal("myservice", ex.GetValue <string>(context));
        }
        public override bool Equals(object other)
        {
            if (this == other)
            {
                return(true);
            }

            if (!(other is ServiceExpressionContext))
            {
                return(false);
            }

            ServiceExpressionContext otherContext = (ServiceExpressionContext)other;

            return(_applicationContext == otherContext._applicationContext);
        }