public void GetConstraint_Build_CorrectConstraint()
        {
            var sutXml = new MembersXml()
            {
                Item = new HierarchyXml()
                {
                    ConnectionString = "connStr"
                }
            };
            var ctrXml = new OrderedXml();

            var discoFactoStubFactory = new Mock <DiscoveryRequestFactory>();

            discoFactoStubFactory.Setup(dfs =>
                                        dfs.Build(
                                            It.IsAny <string>(),
                                            It.IsAny <string>(),
                                            It.IsAny <List <string> >(),
                                            It.IsAny <List <PatternValue> >(),
                                            It.IsAny <string>(),
                                            It.IsAny <string>(),
                                            It.IsAny <string>(),
                                            It.IsAny <string>()))
            .Returns(new MembersDiscoveryRequest());
            var discoFactoStub = discoFactoStubFactory.Object;

            var builder = new MembersOrderedBuilder(discoFactoStub);

            builder.Setup(sutXml, ctrXml);
            builder.Build();
            var ctr = builder.GetConstraint();

            Assert.That(ctr, Is.InstanceOf <OrderedConstraint>());
        }
        public void GetConstraint_BuildWithQuery_ConstraintBuilt()
        {
            var sutXml = new MembersXml();

            sutXml.ChildrenOf = "memberCaption";
            var item = new LevelXml();

            sutXml.Item           = item;
            item.ConnectionString = "connectionString";
            item.Perspective      = "perspective";
            item.Dimension        = "dimension";
            item.Hierarchy        = "hierarchy";
            item.Caption          = "level";

            var ctrXml = new OrderedXml();
            var query  = new QueryXml();

            query.InlineQuery = "select label from myTable order by sortOrder";
            ctrXml.Query      = query;

            var builder = new MembersOrderedBuilder();

            builder.Setup(sutXml, ctrXml);
            builder.Build();
            var ctr = builder.GetConstraint();

            Assert.That(ctr, Is.InstanceOf <OrderedConstraint>());
        }