예제 #1
0
        protected NBiConstraint InstantiateConstraint(EquivalentToXml ctrXml)
        {
            Member.EquivalentToConstraint ctr;
            if (ctrXml.Query != null)
            {
                var builder = new ResultSetResolverArgsBuilder(ServiceLocator);
                builder.Setup(ctrXml.Query);
                builder.Setup(ctrXml.Settings);
                builder.Setup(Variables);
                builder.Build();

                var factory  = ServiceLocator.GetResultSetResolverFactory();
                var resolver = factory.Instantiate(builder.GetArgs());
                ctr = new Member.EquivalentToConstraint(resolver);
            }
            else if (ctrXml.Members != null)
            {
                var disco = InstantiateMembersDiscovery(ctrXml.Members);
                ctr = new Member.EquivalentToConstraint(disco);
            }
            else
            {
                ctr = new Member.EquivalentToConstraint(ctrXml.GetItems());
            }

            //Ignore-case if requested
            if (ctrXml.IgnoreCase)
            {
                ctr = ctr.IgnoreCase;
            }
            return(ctr);
        }
예제 #2
0
        protected virtual IResultSetResolver InstantiateResolver(ResultSetSystemXml resultSetXml)
        {
            var argsBuilder = new ResultSetResolverArgsBuilder();

            argsBuilder.Setup(resultSetXml);
            argsBuilder.Setup(resultSetXml.Settings);
            argsBuilder.Setup(base.Variables);
            argsBuilder.Build();

            var factory  = new ResultSetResolverFactory();
            var resolver = factory.Instantiate(argsBuilder.GetArgs());

            return(resolver);
        }
예제 #3
0
        protected override BaseResultSetComparisonConstraint InstantiateConstraint(object obj, SettingsXml settings, TransformationProvider transformation)
        {
            var argsBuilder = new ResultSetResolverArgsBuilder();

            argsBuilder.Setup(obj);
            argsBuilder.Build();

            var factory  = new ResultSetResolverFactory();
            var resolver = factory.Instantiate(argsBuilder.GetArgs());

            var builder = new ResultSetServiceBuilder();

            builder.Setup(resolver);
            if (transformation != null)
            {
                builder.Setup(transformation.Transform);
            }
            var service = builder.GetService();

            return(new SupersetOfConstraint(service));
        }
예제 #4
0
        protected NBiConstraint InstantiateConstraint(ContainXml ctrXml)
        {
            Member.ContainConstraint ctr = null;
            if (ctrXml.Query != null)
            {
                var builder = new ResultSetResolverArgsBuilder(ServiceLocator);
                builder.Setup(ctrXml.Query);
                builder.Setup(ctrXml.Settings);
                builder.Build();

                var factory  = ServiceLocator.GetResultSetResolverFactory();
                var resolver = factory.Instantiate(builder.GetArgs());
                ctr = new Member.ContainConstraint(resolver);
            }
            else if (ctrXml.Members != null)
            {
                var disco = InstantiateMembersDiscovery(ctrXml.Members);
                ctr = new Member.ContainConstraint(disco);
            }
            else if (ctrXml.GetItems().Count() == 1)
            {
                ctr = new Member.ContainConstraint(ctrXml.Caption);
            }
            else
            {
                ctr = new Member.ContainConstraint(ctrXml.GetItems());
            }

            //Ignore-case if requested
            if (ctrXml.IgnoreCase)
            {
                ctr = ctr.IgnoreCase;
            }

            //Exactly
            //if (ctrXml.Exactly)
            //ctr = ctr.Exactly;

            return(ctr);
        }
예제 #5
0
        protected virtual BaseResultSetComparisonConstraint InstantiateConstraint(object obj, SettingsXml settings, TransformationProvider transformation)
        {
            var argsBuilder = new ResultSetResolverArgsBuilder(ServiceLocator);

            argsBuilder.Setup(obj);
            argsBuilder.Setup(settings);
            argsBuilder.Build();

            var factory  = ServiceLocator.GetResultSetResolverFactory();
            var resolver = factory.Instantiate(argsBuilder.GetArgs());

            var serviceBuilder = new ResultSetServiceBuilder();

            serviceBuilder.Setup(resolver);
            if (transformation != null)
            {
                serviceBuilder.Setup(transformation.Transform);
            }

            var service = serviceBuilder.GetService();

            return(new EqualToConstraint(service));
        }