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);
            ctrXml.MoreThan = new MoreThanXml();

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

            Assert.That(ctr, Is.InstanceOf<RowCountConstraint>());
            var rowCount = ctr as RowCountConstraint;
            Assert.That(rowCount.Child, Is.InstanceOf<NUnitCtr.GreaterThanConstraint>());
        }
Пример #2
0
        public void IsHandling_QueryRowCount_True()
        {
            var sutXml = new ExecutionXml();
            var ctrXml = new RowCountXml();
            var testCaseFactory = new TestCaseFactory();

            var actual = testCaseFactory.IsHandling(sutXml.GetType(), ctrXml.GetType());

            Assert.That(actual, Is.True);
        }
Пример #3
0
        public void Instantiate_QueryRowCount_TestCase()
        {
            var sutXml = new ExecutionXml();
            var ctrXml = new RowCountXml();

            var builderMockFactory = new Mock<ITestCaseBuilder>();
            builderMockFactory.Setup(b => b.Setup(sutXml, ctrXml, TestConfiguration.Default));
            builderMockFactory.Setup(b => b.Build());
            builderMockFactory.Setup(b => b.GetSystemUnderTest()).Returns(new SqlCommand());
            builderMockFactory.Setup(b => b.GetConstraint()).Returns(new NBi.NUnit.Execution.RowCountConstraint(null));
            var builder = builderMockFactory.Object;

            var testCaseFactory = new TestCaseFactory();
            testCaseFactory.Register(typeof(ExecutionXml), typeof(RowCountXml), builder);

            var tc = testCaseFactory.Instantiate(sutXml, ctrXml);

            Assert.That(tc, Is.Not.Null);
            builderMockFactory.VerifyAll();
        }
        protected override void SpecificSetup(AbstractSystemUnderTestXml sutXml, AbstractConstraintXml ctrXml)
        {
            if (!(ctrXml is RowCountXml))
                throw new ArgumentException("Constraint must be a 'RowCountXml'");

            ConstraintXml = (RowCountXml)ctrXml;
        }