public void Should_be_possible_to_compare_two_itemTypes() { oval_system_characteristics systemCharacteristics = new OvalDocumentLoader().GetFakeOvalSystemCharacteristics("system_characteristics_with_local_variable.xml"); ItemType itemType = systemCharacteristics.GetSystemDataByReferenceId("3"); ItemType otherItemType = systemCharacteristics.GetSystemDataByReferenceId("3"); GenericItemTypeComparator itemTypeComparator = new GenericItemTypeComparator(); bool resultComparator = itemTypeComparator.IsEquals(itemType, otherItemType); Assert.IsTrue(resultComparator, "the item types are not equals"); otherItemType = systemCharacteristics.GetSystemDataByReferenceId("1"); resultComparator = itemTypeComparator.IsEquals(itemType, otherItemType); Assert.IsFalse(resultComparator, "the item types are not equals"); }
public void Should_be_possible_to_compare_two_unix_itemTypes() { var systemCharacteristics = new OvalDocumentLoader() .GetFakeOvalSystemCharacteristics("system_characteristics_with_sets.xml"); var itemType = systemCharacteristics.GetSystemDataByReferenceId("6"); var otherItemType = systemCharacteristics.GetSystemDataByReferenceId("7"); var itemTypeComparator = new GenericItemTypeComparator(); var resultComparator = itemTypeComparator.IsEquals(itemType, otherItemType); Assert.IsFalse(resultComparator, "the item types are not equals"); otherItemType = systemCharacteristics.GetSystemDataByReferenceId("1"); resultComparator = itemTypeComparator.IsEquals(itemType, otherItemType); Assert.IsFalse(resultComparator, "the item types are not equals"); }
public void Should_be_possible_to_compare_two_windows_itemTypes_when_they_were_created_manually() { ItemType firstItemType = new registry_item() { name = new EntityItemStringType() { Value = "Modulo" } }; ItemType secondItemType = new registry_item() { name = new EntityItemStringType() { Value = "Microsoft" } }; var itemTypeComparator = new GenericItemTypeComparator(); var comparisionResult = itemTypeComparator.IsEquals(firstItemType, secondItemType); Assert.IsFalse(comparisionResult, "The compared items are different"); }
public ItemType GetItemType(ItemType itemType) { GenericItemTypeComparator itemTypeComparator = new GenericItemTypeComparator(); IEnumerable <ItemType> itemTypes = this.probeResult.GetItemTypes(); foreach (var existingItemType in itemTypes) { if (itemTypeComparator.IsEquals(itemType, existingItemType)) { return existingItemType; } } return null; }