예제 #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 RowCountXml(SettingsXml.Empty)
            {
                MoreThan = new MoreThanXml()
                {
                    Value = "100"
                }
            };

            var builder = new ResultSetRowCountBuilder();

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

            Assert.That(ctr, Is.InstanceOf <RowCountConstraint>());
            var rowCount = ctr as RowCountConstraint;

            Assert.That(rowCount.Differed.Resolve(), Is.InstanceOf <NUnitCtr.GreaterThanConstraint>());
        }
예제 #2
0
        public void GetConstraint_RowCountFiltered_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 RowCountXml(SettingsXml.Empty);

            ctrXml.Equal       = new EqualXml();
            ctrXml.Equal.Value = "50";
            ctrXml.Filter      = new FilterXml();
            ctrXml.Filter.InternalAliases.Add(new AliasXml());
            ctrXml.Filter.Predication = new PredicationXml()
            {
                Predicate = new NullXml(), Operand = "myColumn"
            };

            var builder = new ResultSetRowCountBuilder();

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

            Assert.That(ctr, Is.InstanceOf <RowCountFilterConstraint>());
            var rowCount = ctr as RowCountFilterConstraint;

            Assert.That(rowCount.Differed.Resolve(), Is.InstanceOf <NUnitCtr.EqualConstraint>());
        }
예제 #3
0
        public void GetSystemUnderTest_ExecutionXml_IResultSetService()
        {
            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 RowCountXml(SettingsXml.Empty)
            {
                MoreThan = new MoreThanXml()
                {
                    Value = "10"
                }
            };

            var builder = new ResultSetRowCountBuilder();

            builder.Setup(sutXml, ctrXml, null, null, new ServiceLocator());
            builder.Build();
            var sut = builder.GetSystemUnderTest();

            Assert.That(sut, Is.Not.Null);
            Assert.That(sut, Is.InstanceOf <IResultSetService>());
        }
예제 #4
0
        public void GetConstraint_PercentageForRowCount_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 RowCountXml(SettingsXml.Empty)
            {
                Equal = new EqualXml()
                {
                    Reference = "50.4%"
                },
                Filter = new FilterXml()
                {
                    InternalAliases = new List <AliasXml>()
                    {
                        new AliasXml()
                    },
                    Predication = new SinglePredicationXml()
                    {
                        Predicate = new NullXml(), Operand = new ColumnNameIdentifier("myColumn")
                    }
                }
            };

            var builder = new ResultSetRowCountBuilder();

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

            Assert.That(ctr, Is.InstanceOf <RowCountFilterPercentageConstraint>());
            var rowCount = ctr as RowCountFilterPercentageConstraint;

            Assert.That(rowCount.Differed.Resolve(), Is.InstanceOf <NUnitCtr.EqualConstraint>());
        }
예제 #5
0
        public void GetSystemUnderTest_ResultSetSystemXml_IResultSetService()
        {
            var sutXmlStub = new Mock <Systems.ResultSetSystemXml>();

            sutXmlStub.Setup(s => s.File.Path).Returns("myFile.csv");
            var sutXml = sutXmlStub.Object;

            var ctrXml = new RowCountXml(SettingsXml.Empty)
            {
                MoreThan = new MoreThanXml()
                {
                    Value = "10"
                }
            };

            var builder = new ResultSetRowCountBuilder();

            builder.Setup(sutXml, ctrXml, null, null, new ServiceLocator());
            builder.Build();
            var sut = builder.GetSystemUnderTest();

            Assert.That(sut, Is.Not.Null);
            Assert.That(sut, Is.InstanceOf <IResultSetService>());
        }