Beispiel #1
0
        public void GetConstraint_BuildWithResultSet_CorrectConstraint()
        {
            var sutXmlStubFactory  = new Mock <Systems.ExecutionXml>();
            var itemXmlStubFactory = new Mock <QueryableXml>();

            itemXmlStubFactory.Setup(i => i.GetQuery()).Returns("query");
            sutXmlStubFactory.Setup(s => s.Item).Returns(itemXmlStubFactory.Object);
            var sutXml = sutXmlStubFactory.Object;

            sutXml.Item = itemXmlStubFactory.Object;

            var ctrXml = new SomeRowsXml
            {
                Predication = new PredicationXml()
                {
                    Predicate = new MoreThanXml()
                    {
                        Value = "100"
                    },
                    Operand = "#0"
                }
            };

            var builder = new ResultSetSomeRowsBuilder();

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

            Assert.That(ctr, Is.InstanceOf <SomeRowsConstraint>());
            var someRows = ctr as SomeRowsConstraint;

            Assert.That(someRows.Differed, Is.Null);
        }
Beispiel #2
0
        public void GetConstraint_BuildWithResultSet_CorrectConstraint()
        {
            var sutXmlStubFactory  = new Mock <Systems.ExecutionXml>();
            var itemXmlStubFactory = new Mock <QueryXml>();

            itemXmlStubFactory.Setup(i => i.InlineQuery).Returns("query");
            itemXmlStubFactory.Setup(i => i.Settings).Returns(SettingsXml.Empty);
            sutXmlStubFactory.Setup(s => s.Item).Returns(itemXmlStubFactory.Object);
            var sutXml = sutXmlStubFactory.Object;

            sutXml.Item = itemXmlStubFactory.Object;

            var ctrXml = new SomeRowsXml
            {
                Predication = new SinglePredicationXml()
                {
                    Predicate = new MoreThanXml()
                    {
                        Reference = "100"
                    },
                    Operand = new ColumnOrdinalIdentifier(0)
                }
            };

            var builder = new ResultSetSomeRowsBuilder();

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

            Assert.That(ctr, Is.InstanceOf <SomeRowsConstraint>());
            var someRows = ctr as SomeRowsConstraint;

            Assert.That(someRows.Differed, Is.Null);
        }