public void Should_be_possible_to_generate_items_to_collect_from_a_sql57_object()
        {
            var fakeObject = ProbeHelper.GetDefinitionObjectTypeByID("definitionsSimple", "5100");

            var itemsToCollect = new Sql57ItemTypeGenerator().GetItemsToCollect(fakeObject, null);

            Assert.IsNotNull(itemsToCollect);
            ItemTypeChecker.DoBasicAssertForItems(itemsToCollect.ToArray(), 1, typeof(sql57_item));
            AssertSql57Item((sql57_item)itemsToCollect.Single());
        }
        public void Should_be_possible_to_generate_items_to_collect_from_a_sql57_object_with_referenced_variable_with_multiple_values_on_engine_entity()
        {
            var fakeVariables = VariableHelper.CreateVariableWithMultiplesValue("5110", "5010", new string[] { "oracle", "sqlserver" });
            var fakeObject = ProbeHelper.GetDefinitionObjectTypeByID("definitionsSimple", "5110");

            var itemsToCollect = new Sql57ItemTypeGenerator().GetItemsToCollect(fakeObject, fakeVariables);

            Assert.AreEqual(2, itemsToCollect.Count());
            AssertSql57Item((sql57_item)itemsToCollect.ElementAt(0), "oracle");
            AssertSql57Item((sql57_item)itemsToCollect.ElementAt(1), "sqlserver");
        }
        public void Should_be_possible_to_generate_items_to_collect_from_a_sql57_object_with_referenced_variable_on_engine_entity()
        {
            var fakeVariables = VariableHelper.CreateVariableWithOneValue("5110", "5010", "oracle");
            var fakeObject = ProbeHelper.GetDefinitionObjectTypeByID("definitionsSimple", "5110");

            var itemsToCollect = new Sql57ItemTypeGenerator().GetItemsToCollect(fakeObject, fakeVariables);

            AssertSql57Item((sql57_item)itemsToCollect.Single());
        }
        public void Should_be_possible_to_generate_items_to_collect_from_a_sql57_object_with_referenced_variable_with_multiple_values_in_all_entities()
        {
            var fakeVariables = VariableHelper.CreateEvaluatedVariables("oval:modulo:obj:5150", this.FakeVariableWithMultipleValues);
            var fakeObject = ProbeHelper.GetDefinitionObjectTypeByID("definitionsSimple", "5150");

            var itemsToCollect = new Sql57ItemTypeGenerator().GetItemsToCollect(fakeObject, fakeVariables);

            Assert.AreEqual(16, itemsToCollect.Count());
            AssertSql57Item((sql57_item)itemsToCollect.ElementAt(0), "postgres", "8", FAKE_CONNECTION_STRING, FAKE_SQL_QUERY);
            AssertSql57Item((sql57_item)itemsToCollect.ElementAt(1), "postgres", "8", FAKE_CONNECTION_STRING, FAKE_SQL_QUERY2);
            AssertSql57Item((sql57_item)itemsToCollect.ElementAt(2), "postgres", "8", FAKE_CONNECTION_STRING2, FAKE_SQL_QUERY);
            AssertSql57Item((sql57_item)itemsToCollect.ElementAt(3), "postgres", "8", FAKE_CONNECTION_STRING2, FAKE_SQL_QUERY2);
            AssertSql57Item((sql57_item)itemsToCollect.ElementAt(4), "postgres", "2", FAKE_CONNECTION_STRING, FAKE_SQL_QUERY);
            AssertSql57Item((sql57_item)itemsToCollect.ElementAt(5), "postgres", "2", FAKE_CONNECTION_STRING, FAKE_SQL_QUERY2);
            AssertSql57Item((sql57_item)itemsToCollect.ElementAt(6), "postgres", "2", FAKE_CONNECTION_STRING2, FAKE_SQL_QUERY);
            AssertSql57Item((sql57_item)itemsToCollect.ElementAt(7), "postgres", "2", FAKE_CONNECTION_STRING2, FAKE_SQL_QUERY2);
            AssertSql57Item((sql57_item)itemsToCollect.ElementAt(8), "db2", "8", FAKE_CONNECTION_STRING, FAKE_SQL_QUERY);
            AssertSql57Item((sql57_item)itemsToCollect.ElementAt(9), "db2", "8", FAKE_CONNECTION_STRING, FAKE_SQL_QUERY2);
            AssertSql57Item((sql57_item)itemsToCollect.ElementAt(10), "db2", "8", FAKE_CONNECTION_STRING2, FAKE_SQL_QUERY);
            AssertSql57Item((sql57_item)itemsToCollect.ElementAt(11), "db2", "8", FAKE_CONNECTION_STRING2, FAKE_SQL_QUERY2);
            AssertSql57Item((sql57_item)itemsToCollect.ElementAt(12), "db2", "2", FAKE_CONNECTION_STRING, FAKE_SQL_QUERY);
            AssertSql57Item((sql57_item)itemsToCollect.ElementAt(13), "db2", "2", FAKE_CONNECTION_STRING, FAKE_SQL_QUERY2);
            AssertSql57Item((sql57_item)itemsToCollect.ElementAt(14), "db2", "2", FAKE_CONNECTION_STRING2, FAKE_SQL_QUERY);
            AssertSql57Item((sql57_item)itemsToCollect.ElementAt(15), "db2", "2", FAKE_CONNECTION_STRING2, FAKE_SQL_QUERY2);
        }
        public void Should_be_possible_to_generate_items_to_collect_from_a_sql57_object_with_referenced_variable_in_all_entities()
        {
            var fakeVariables = VariableHelper.CreateEvaluatedVariables("oval:modulo:obj:5150", this.FakeVariableWithSingleValues);
            var fakeObject = ProbeHelper.GetDefinitionObjectTypeByID("definitionsSimple", "5150");

            var itemsToCollect = new Sql57ItemTypeGenerator().GetItemsToCollect(fakeObject, fakeVariables);

            Assert.AreEqual(1, itemsToCollect.Count());
            AssertSql57Item((sql57_item)itemsToCollect.Single(), "postgres", "8", FAKE_CONNECTION_STRING2, FAKE_SQL_QUERY2);
        }
        public void Should_be_possible_to_generate_items_to_collect_from_a_sql57_object_with_referenced_variable_with_multiple_values_on_sql_entity()
        {
            var fakeConnectionStrings = new string[] { FAKE_SQL_QUERY, FAKE_SQL_QUERY2 };
            var fakeVariables = VariableHelper.CreateVariableWithMultiplesValue("5140", "5040", fakeConnectionStrings);
            var fakeObject = ProbeHelper.GetDefinitionObjectTypeByID("definitionsSimple", "5140");

            var itemsToCollect = new Sql57ItemTypeGenerator().GetItemsToCollect(fakeObject, fakeVariables);

            Assert.AreEqual(2, itemsToCollect.Count());
            AssertSql57Item((sql57_item)itemsToCollect.ElementAt(0), "oracle", "9", FAKE_CONNECTION_STRING, FAKE_SQL_QUERY);
            AssertSql57Item((sql57_item)itemsToCollect.ElementAt(1), "oracle", "9", FAKE_CONNECTION_STRING, FAKE_SQL_QUERY2);
        }