public void Should_be_possible_to_get_a_system_characteristics_in_xml_format_given_a_probeResult()
        {
            SystemCharacteristicsFactory factory = new SystemCharacteristicsFactory();

            ProbeResult probe = new ProbeResultFactory().CreateProbeResultForRegistryCollect();

            string systemCharacteristicsXML = factory.CreateSystemCharacteristicsInXMLFormat(probe);

            Assert.IsNotNull(systemCharacteristicsXML);

            //creates a stream for the xml generated
            MemoryStream                m = new MemoryStream(Encoding.UTF8.GetBytes(systemCharacteristicsXML));
            IEnumerable <string>        loadErrors;
            oval_system_characteristics systemCharacteristicsFromXmlGenerated = oval_system_characteristics.GetOvalSystemCharacteristicsFromStream(m, out loadErrors);

            Assert.IsNotNull(systemCharacteristicsFromXmlGenerated, "Not was possible to get a SystemCharacteristis given the xml generated");
            Assert.IsTrue(loadErrors.Count() == 0, "there are errors in the xml");
        }
        public void Should_be_possible_to_get_a_system_characteristics_in_xml_format_given_a_probeResult_with_variables_defined()
        {
            SystemCharacteristicsFactory factory = new SystemCharacteristicsFactory();

            ProbeResult probe = new ProbeResultFactory().CreateProbeResultForRegistryCollectWithVariables();

            string systemCharacteristicsXML = factory.CreateSystemCharacteristicsInXMLFormat(probe);

            Assert.IsNotNull(systemCharacteristicsXML);

            //creates a stream for the xml generated
            MemoryStream                m = new MemoryStream(Encoding.UTF8.GetBytes(systemCharacteristicsXML));
            IEnumerable <string>        loadErrors;
            oval_system_characteristics systemCharacteristicsFromXmlGenerated = oval_system_characteristics.GetOvalSystemCharacteristicsFromStream(m, out loadErrors);

            Assert.IsNotNull(systemCharacteristicsFromXmlGenerated, "Not was possible to get a SystemCharacteristis given the xml generated");
            Assert.IsTrue(loadErrors.Count() == 0, "there are errors in the xml");
            Assert.AreEqual(systemCharacteristicsFromXmlGenerated.collected_objects[0].variable_value[0].variable_id, "oval:com.hp:var:4", "the variable Id is not expected");
            Assert.AreEqual(systemCharacteristicsFromXmlGenerated.collected_objects[0].variable_value[0].Value, "Microsoft\\WindowsNT\\", "the variable value is not expected");
        }
Esempio n. 3
0
        /// <summary>
        /// Creates the CollectResult specific for the ProbeExecution.
        /// </summary>
        /// <param name="probeResult">The probe result.</param>
        /// <returns></returns>
        public CollectResult CreateCollectResultForTheProbeExecution(ProbeResult probeResult)
        {
            var systemCharacteristics = systemCharacteristicsFactory.CreateSystemCharacteristicsInXMLFormat(probeResult);

            return(this.CreateCollectResult(GetCollectResultStatus(probeResult), systemCharacteristics));
        }