Ejemplo n.º 1
0
        public void Filter_Distinct_EmptyContent()
        {
            var manager = new TestCaseManager();
            //Setup content;
            manager.Content.Columns.Add(new DataColumn("columnName"));
            manager.Variables.Add("columnName");
            manager.Content.AcceptChanges();

            //Setup filter
            manager.FilterDistinct();

            Assert.That(manager.Content.Rows, Has.Count.EqualTo(0));
        }
Ejemplo n.º 2
0
        public void Filter_EqualWithoutMatch_EmptyContent()
        {
            var manager = new TestCaseManager();
            //Setup content;
            manager.Content.Columns.Add(new DataColumn("columnName"));
            manager.Variables.Add("columnName");
            var nonMatchingRow1 = manager.Content.NewRow();
            nonMatchingRow1[0] = "abc";
            var nonMatchingRow2 = manager.Content.NewRow();
            nonMatchingRow2[0] = "xyz";
            manager.Content.Rows.Add(nonMatchingRow1);
            manager.Content.Rows.Add(nonMatchingRow2);
            manager.Content.AcceptChanges();

            //Setup filter
            manager.Filter("columnName", Operator.Equal, false, "matching");

            Assert.That(manager.Content.Rows, Has.Count.EqualTo(0));
        }
Ejemplo n.º 3
0
        public void Filter_EqualMultipleValues_CorrectNewContent()
        {
            var manager = new TestCaseManager();
            //Setup content;
            manager.Content.Columns.Add(new DataColumn("columnName"));
            manager.Variables.Add("columnName");
            var matchingRow1 = manager.Content.NewRow();
            matchingRow1[0] = "matching 1";
            var matchingRow2 = manager.Content.NewRow();
            matchingRow2[0] = "matching 2";
            var nonMatchingRow = manager.Content.NewRow();
            nonMatchingRow[0] = "xyz";
            manager.Content.Rows.Add(matchingRow1);
            manager.Content.Rows.Add(matchingRow2);
            manager.Content.Rows.Add(nonMatchingRow);
            manager.Content.AcceptChanges();

            //Setup filter
            manager.Filter("columnName", Operator.Equal, false, new [] {"matching 1", "matching 2"});

            Assert.That(manager.Content.Rows, Has.Count.EqualTo(2));
            Assert.That(manager.Content.Rows[0][0], Is.EqualTo("matching 1"));
            Assert.That(manager.Content.Rows[1][0], Is.EqualTo("matching 2"));
        }
Ejemplo n.º 4
0
        public void Filter_Distinct_CorrectNewContent()
        {
            var manager = new TestCaseManager();
            //Setup content;
            manager.Content.Columns.Add(new DataColumn("columnName"));
            manager.Variables.Add("columnName");
            var firstRow = manager.Content.NewRow();
            firstRow[0] = "alpha";
            var secondRow = manager.Content.NewRow();
            secondRow[0] = "beta";
            var duplicatedRow = manager.Content.NewRow();
            duplicatedRow[0] = "alpha";
            manager.Content.Rows.Add(firstRow);
            manager.Content.Rows.Add(secondRow);
            manager.Content.Rows.Add(duplicatedRow);
            manager.Content.AcceptChanges();

            //Setup filter
            manager.FilterDistinct();

            Assert.That(manager.Content.Rows, Has.Count.EqualTo(2));
            Assert.That(manager.Content.Rows[0][0], Is.EqualTo("alpha"));
            Assert.That(manager.Content.Rows[1][0], Is.EqualTo("beta"));
        }
Ejemplo n.º 5
0
        public void Filter_NotEqual_CorrectNewContent()
        {
            var manager = new TestCaseManager();
            //Setup content;
            manager.Content.Columns.Add(new DataColumn("columnName"));
            manager.Variables.Add("columnName");
            var matchingRow = manager.Content.NewRow();
            matchingRow[0] = "matching";
            var nonMatchingRow = manager.Content.NewRow();
            nonMatchingRow[0] = "xyz";
            manager.Content.Rows.Add(matchingRow);
            manager.Content.Rows.Add(nonMatchingRow);
            manager.Content.AcceptChanges();

            //Setup filter
            manager.Filter("columnName", Operator.Equal, true, "matching");

            Assert.That(manager.Content.Rows, Has.Count.EqualTo(1));
            Assert.That(manager.Content.Rows[0][0], Is.Not.EqualTo("matching"));
        }