public void Instantiate_NativeTransformationInsideFormat_FormatResolverArgs()
        {
            var factory = new ScalarResolverArgsFactory(new ServiceLocator(), null);;
            var args    = factory.Instantiate("~{@myVar | dateTime-to-previous-month : dddd} ");

            Assert.That(args, Is.TypeOf <FormatScalarResolverArgs>());
        }
        public void Instantiate_ContextWithFormat_LiteralResolverArgs()
        {
            var factory = new ScalarResolverArgsFactory(new ServiceLocator(), null);;
            var args    = factory.Instantiate("[~{@date:yyyy}]");

            Assert.That(args, Is.TypeOf <ContextScalarResolverArgs>());
        }
        public void Instantiate_Variable_ContextResolverArgs()
        {
            var factory = new ScalarResolverArgsFactory(new ServiceLocator(), null);;
            var args    = factory.Instantiate("[myColumn]");

            Assert.That(args, Is.TypeOf <ContextScalarResolverArgs>());
        }
        public void Instantiate_Variable_GlobalVariableResolverArgs()
        {
            var factory = new ScalarResolverArgsFactory(new ServiceLocator(), null);;
            var args    = factory.Instantiate("@myVar");

            Assert.That(args, Is.TypeOf <GlobalVariableScalarResolverArgs>());
        }
        public void Instantiate_Format_FormatResolverArgs()
        {
            var factory = new ScalarResolverArgsFactory(new ServiceLocator(), null);;
            var args    = factory.Instantiate("~First day of 2018 is a { @myVar: dddd}");

            Assert.That(args, Is.TypeOf <FormatScalarResolverArgs>());
        }
        public void Instantiate_Literal_LiteralResolverArgs()
        {
            var factory = new ScalarResolverArgsFactory(new ServiceLocator(), null);;
            var args    = factory.Instantiate("First day of 2018 is a Monday");

            Assert.That(args, Is.TypeOf <LiteralScalarResolverArgs>());
        }
        public void Instantiate_LiteralWithGravesAndPipes_LiteralResolverArgs()
        {
            var factory = new ScalarResolverArgsFactory(new ServiceLocator(), null);;
            var args    = factory.Instantiate("`a|b|c`");

            Assert.That(args, Is.TypeOf <LiteralScalarResolverArgs>());
            Assert.That((args as LiteralScalarResolverArgs).Object, Is.EqualTo("a|b|c"));
        }
        public void Instantiate_ColumnWithBrakets_ContextResolverArgs()
        {
            var factory = new ScalarResolverArgsFactory(new ServiceLocator(), null);;
            var args    = factory.Instantiate("[[schema].[column]]");

            Assert.That(args, Is.TypeOf <ContextScalarResolverArgs>());
            Assert.That((args as ContextScalarResolverArgs).ColumnIdentifier.Label, Is.EqualTo("[[schema].[column]]"));
        }
        public void Instantiate_MDXParameter_LiteralResolverArgs()
        {
            var factory = new ScalarResolverArgsFactory(new ServiceLocator(), null);;
            var args    = factory.Instantiate("[dimension].[hierarchy].[member]");

            Assert.That(args, Is.TypeOf <LiteralScalarResolverArgs>());
            Assert.That((args as LiteralScalarResolverArgs).Object, Is.EqualTo("[dimension].[hierarchy].[member]"));
        }
        public void Instantiate_NativeTransformationWithFormat_FunctionResolverArgs()
        {
            var factory = new ScalarResolverArgsFactory(new ServiceLocator(), null);;
            var args    = factory.Instantiate("~{@myVar : dddd} | text-to-length");

            Assert.That(args, Is.TypeOf <FunctionScalarResolverArgs>());
            var typedArgs = args as FunctionScalarResolverArgs;

            Assert.That(typedArgs.Resolver, Is.TypeOf <FormatScalarResolver>());
            Assert.That(typedArgs.Transformations.Count, Is.EqualTo(1));
            Assert.That(typedArgs.Transformations.ElementAt(0), Is.TypeOf <TextToLength>());
        }
Example #11
0
        protected override ResultSet Execute(ResultSet rs, int ordinal)
        {
            var argsFactory = new ScalarResolverArgsFactory(ServiceLocator, Context);
            var args        = argsFactory.Instantiate(Code);
            var factory     = ServiceLocator.GetScalarResolverFactory();
            var resolver    = factory.Instantiate(args);

            foreach (DataRow row in rs.Rows)
            {
                Context.Switch(row);
                row[ordinal] = resolver.Execute();
            }
            return(rs);
        }