Esempio n. 1
0
        /// <summary>
        /// Creates the collect result from the SystemCharacteristics List.
        /// The collectResult systemCharacteristics properties will be the merge of all the systemCharacteristics in the list.
        /// </summary>
        /// <param name="systemCharacteristics">The system characteristics.</param>
        /// <param name="status">The status of the collect result</param>
        /// <returns></returns>
        public CollectResult CreateCollectResultFromOvalSystemCharacteristics(IEnumerable <oval_system_characteristics> systemCharacteristics, CollectStatus status)
        {
            var systemCharacteristicsComplete = systemCharacteristicsFactory.CreateSystemCharacteristicsBy(systemCharacteristics);
            var systemCharacteristicsInXML    = systemCharacteristicsComplete.GetSystemCharacteristicsXML();
            var collectResult = this.CreateCollectResult(status, systemCharacteristicsInXML);

            return(null);
        }
        public void Should_be_possible_to_create_a_new_systemCharacteristics_from_the_combination_with_others_and_the_systemInformation_by_SystemInfo()
        {
            SystemCharacteristicsFactory factory = new SystemCharacteristicsFactory();

            oval_system_characteristics        systemCharacteristics      = this.GetSystemCharacteristics("oval.org.mitre.oval.sc.5368.xml");
            oval_system_characteristics        otherSystemCharacteristics = this.GetSystemCharacteristics("fdcc_xpfirewall_oval.sc.xml");
            List <oval_system_characteristics> scList = new List <oval_system_characteristics>();

            scList.Add(systemCharacteristics);
            scList.Add(otherSystemCharacteristics);

            Target target = this.CreateTargetWithSystemInformation();

            oval_system_characteristics newSystemCharacteristics = factory.CreateSystemCharacteristicsBy(scList, target.SystemInformation);

            Assert.IsNotNull(newSystemCharacteristics, "the systemCaracteristics expected is null");
            Assert.IsNotNull(newSystemCharacteristics.system_info, "the system_info is null");
            Assert.AreEqual(newSystemCharacteristics.system_info.architecture, target.SystemInformation.Architecture);
            Assert.AreEqual(newSystemCharacteristics.system_info.os_name, target.SystemInformation.SystemName);
            Assert.AreEqual(newSystemCharacteristics.system_info.os_version, target.SystemInformation.SystemVersion);
        }
        public void Should_be_possible_to_create_a_new_systemCharacteristics_from_the_combination_with_others()
        {
            SystemCharacteristicsFactory factory = new SystemCharacteristicsFactory();

            oval_system_characteristics        systemCharacteristics      = this.GetSystemCharacteristics("oval.org.mitre.oval.sc.5368.xml");
            oval_system_characteristics        otherSystemCharacteristics = this.GetSystemCharacteristics("fdcc_xpfirewall_oval.sc.xml");
            List <oval_system_characteristics> scList = new List <oval_system_characteristics>();

            scList.Add(systemCharacteristics);
            scList.Add(otherSystemCharacteristics);


            oval_system_characteristics newSystemCharacteristics = factory.CreateSystemCharacteristicsBy(scList);

            int quantityCollectedObject = systemCharacteristics.collected_objects.Count() + otherSystemCharacteristics.collected_objects.Count();
            int quantitySystemData      = systemCharacteristics.system_data.Count() + otherSystemCharacteristics.system_data.Count();

            Assert.IsNotNull(newSystemCharacteristics, "the systemCharacteristics expected is null");
            Assert.IsTrue(newSystemCharacteristics.collected_objects.Count() == quantityCollectedObject, " the quantity of collected objects is not expected");
            Assert.IsTrue(newSystemCharacteristics.system_data.Count() == quantitySystemData, "the quantity of system data is no expected");
        }