public void GetSystemUnderTest_Build_CorrectDiscoveryCommand()
        {
            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 EqualToXml(SettingsXml.Empty);
            ctrXml.Query = new Items.QueryXml() { InlineQuery = "query" };

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

            Assert.That(sut, Is.InstanceOf<IDbCommand>());
        }
Exemplo n.º 2
0
        protected override void SpecificSetup(AbstractSystemUnderTestXml sutXml, AbstractConstraintXml ctrXml)
        {
            if (!(ctrXml is EqualToXml))
                throw new ArgumentException("Constraint must be a 'EqualToXml'");

            ConstraintXml = (EqualToXml)ctrXml;
        }
Exemplo n.º 3
0
        private ResultSetComparisonSettings BuildSettings()
        {
            //Buiding object used during test
            var xml = new EqualToXml();
            //default values/def
            xml.KeysDef = ResultSetComparisonSettings.KeysChoice.AllExpectLast;
            //default tolerance
            xml.Tolerance = "100";

            //Build a value column (numeric, specific tolerance)
            var colXml = new ColumnDefinitionXml();
            colXml.Index = 1;
            colXml.Role = ColumnRole.Value;
            colXml.Type = ColumnType.Numeric;
            colXml.Tolerance = "1";

            //Build a value column (without info)
            var colLightXml = new ColumnDefinitionXml();
            colLightXml.Index = 2;
            colLightXml.Role = ColumnRole.Value;

            //Build a value column (numeric)
            var col4Xml = new ColumnDefinitionXml();
            col4Xml.Index = 4;
            col4Xml.Role = ColumnRole.Value;
            col4Xml.Type = ColumnType.Numeric;

            //Build a ignore column (without info)
            var colIgnoreXml = new ColumnDefinitionXml();
            colIgnoreXml.Index = 5;
            colIgnoreXml.Role = ColumnRole.Ignore;

            //Add columns to definition
            var cols = new List<ColumnDefinitionXml>();
            cols.Add(colXml);
            cols.Add(colLightXml);
            cols.Add(col4Xml);
            cols.Add(colIgnoreXml);
            xml.columnsDef = cols;

            //get settings
            var settings = xml.GetSettings();

            //Set the columnCount
            settings.ApplyTo(10);

            return settings;
        }
Exemplo n.º 4
0
        public void IsHandling_StructureEqualTo_False()
        {
            var sutXml = new StructureXml();
            var ctrXml = new EqualToXml();
            var testCaseFactory = new TestCaseFactory();

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

            Assert.That(actual, Is.False);
        }
Exemplo n.º 5
0
        public void IsHandling_QueryEqualTo_True()
        {
            var sutXml = new ExecutionXml();
            var ctrXml = new EqualToXml();
            var testCaseFactory = new TestCaseFactory();

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

            Assert.That(actual, Is.True);
        }
Exemplo n.º 6
0
        public void Instantiate_StructureEqualTo_ArgumentException()
        {
            var sutXml = new StructureXml();
            var ctrXml = new EqualToXml();
            var testCaseFactory = new TestCaseFactory();

            Assert.Throws<ArgumentException>(delegate { testCaseFactory.Instantiate(sutXml, ctrXml); });
        }
Exemplo n.º 7
0
        public void Instantiate_QueryEqualTo_TestCase()
        {
            var sutXml = new ExecutionXml();
            var ctrXml = new EqualToXml();

            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 EqualToConstraint("value"));
            var builder = builderMockFactory.Object;

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

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

            Assert.That(tc, Is.Not.Null);
            builderMockFactory.VerifyAll();
        }