public static void DoBasicAssertForItems( IEnumerable <ItemType> itemsToAssert, int expectedItemsCount, Type expectedInstanceOfItems, StatusEnumeration expectedStatus = StatusEnumeration.exists) { Assert.IsNotNull(itemsToAssert, "There is no items."); Assert.AreEqual(expectedItemsCount, itemsToAssert.Count(), "Unexpected items count was found."); foreach (var item in itemsToAssert) { if (item.status != expectedStatus) { if (item.status == StatusEnumeration.error) { Assert.Fail(ITEM_WITH_UNEXPECTED_ERROR_STATUS, expectedStatus, item.message.First().Value); } else { Assert.AreEqual(expectedStatus, item.status, UNEXPECTED_ITEM_STATUS_MSG); } } Assert.IsInstanceOfType(item, expectedInstanceOfItems, UNEXPECTED_ITEM_INSTANCE_TYPE_MSG); } }
public ItemType CreateFileItemTypesWithError(string path, string fileName, string trustee, string message, StatusEnumeration status) { ItemType itemType = this.CreateItemTypeForCollect(path, fileName, trustee); itemType.message = MessageType.FromErrorString(message); itemType.status = status; return itemType; }
private void SetTrusteeNameEntityStatus(sid_item sidItem, StatusEnumeration status) { if (sidItem.status.Equals(StatusEnumeration.doesnotexist) || sidItem.status.Equals(StatusEnumeration.error)) { sidItem.trustee_name.status = status; sidItem.trustee_name.Value = string.Empty; } }
public void SetUserEntityStatus(StatusEnumeration status) { EntityItemStringType userNameEntity = ((user_item)base.BuiltItemType).user; userNameEntity.status = status; if ((status == StatusEnumeration.doesnotexist) || (status == StatusEnumeration.error)) userNameEntity.Value = string.Empty; }
public void SetGroupEntityStatus(EntityItemSimpleBaseType groupNameEntity, StatusEnumeration status) { groupNameEntity.status = status; if ((status == StatusEnumeration.doesnotexist) || (status == StatusEnumeration.error)) { groupNameEntity.Value = string.Empty; } }
public void SetTrusteeEntityStatus(StatusEnumeration status) { EntityItemStringType trusteeSidEntity = ((sid_sid_item)base.BuiltItemType).trustee_sid; trusteeSidEntity.status = status; if ((status == StatusEnumeration.doesnotexist) || (status == StatusEnumeration.error)) trusteeSidEntity.Value = string.Empty; }
private void SetTrusteeSIDEntityStatus(sid_sid_item sidsidItem, StatusEnumeration status) { sidsidItem.trustee_sid.status = status; if (status.Equals(StatusEnumeration.doesnotexist) || status.Equals(StatusEnumeration.error)) { sidsidItem.trustee_sid.Value = string.Empty; } }
/// <summary> /// Set the status and message for the current building item type. /// </summary> /// <param name="collectStatus">The status of collection item (Exists, Does not Exist, Not collected, Error...).</param> /// <param name="errorMessage">Optional message error. If this parameter is passed as null, it will be ignored.</param> /// <remarks></remarks> public virtual void SetItemTypeStatus(StatusEnumeration itemTypeStatus, string itemTypeMessage) { if (this.BuildingItemType != null) { this.BuildingItemType.status = itemTypeStatus; this.BuildingItemType.message = MessageType.FromString(itemTypeMessage); this.BuildItemType(); } }
public void SetTrusteeEntityStatus(StatusEnumeration status) { EntityItemStringType trusteeSidEntity = ((sid_sid_item)base.BuiltItemType).trustee_sid; trusteeSidEntity.status = status; if ((status == StatusEnumeration.doesnotexist) || (status == StatusEnumeration.error)) { trusteeSidEntity.Value = string.Empty; } }
public void SetUserEntityStatus(StatusEnumeration status) { EntityItemStringType userNameEntity = ((user_item)base.BuiltItemType).user; userNameEntity.status = status; if ((status == StatusEnumeration.doesnotexist) || (status == StatusEnumeration.error)) { userNameEntity.Value = string.Empty; } }
private fileeffectiverights_item CreateItemToCollect( string filepath, string trusteeSID, StatusEnumeration status = StatusEnumeration.exists) { return(new fileeffectiverights_item() { filepath = OvalHelper.CreateItemEntityWithStringValue(filepath), path = OvalHelper.CreateItemEntityWithStringValue(Path.GetDirectoryName(filepath)), filename = OvalHelper.CreateItemEntityWithStringValue(Path.GetFileName(filepath)), trustee_name = OvalHelper.CreateItemEntityWithStringValue("sid") }); }
public Person(Name name, string email, DateTime birth, IEnumerable <Parent> parents, Cpf cpf, HobbyEnumeration hobby, double revenue, string profession, EducationalLevelEnumeration educationalLevel, StatusEnumeration status, bool cloned) { Id = Guid.NewGuid(); Name = name; Email = email; Birth = birth; Parents = parents; Cpf = cpf; Hobby = hobby; Revenue = revenue; Profession = profession; EducationalLevel = educationalLevel; Status = status; Cloned = cloned; }
public static Faker <Domain.Entities.Person> Get(StatusEnumeration status = null) { return(new Faker <Domain.Entities.Person>().CustomInstantiator(f => new Domain.Entities.Person(f.Random.Guid(), new Name(f.Person.FirstName, f.Person.LastName), f.Person.Email, f.Date.Past(), ParentFaker.Get().Generate(2), new Cpf(f.Person.Cpf(), f.Date.Future(), f.Date.Past()), f.PickRandom(HobbyEnumeration.GetAll()), f.Random.Double(), f.Name.JobTitle(), f.PickRandom(EducationalLevelEnumeration.GetAll()), status ?? f.PickRandom(StatusEnumeration.GetAll()), f.Random.Bool()))); }
private user_item CreateUserItem(StatusEnumeration itemStatus) { var newUserItem = new user_item() { status = itemStatus, user = OvalHelper.CreateItemEntityWithStringValue(EVERYONE_USER) }; if (itemStatus.Equals(StatusEnumeration.exists)) { newUserItem.enabled = OvalHelper.CreateBooleanEntityItemFromBoolValue(true); newUserItem.group = new EntityItemStringType[] { OvalHelper.CreateItemEntityWithStringValue("g1") }; } return newUserItem; }
private user_item CreateUserItem(StatusEnumeration itemStatus) { var newUserItem = new user_item() { status = itemStatus, user = OvalHelper.CreateItemEntityWithStringValue(EVERYONE_USER) }; if (itemStatus.Equals(StatusEnumeration.exists)) { newUserItem.enabled = OvalHelper.CreateBooleanEntityItemFromBoolValue(true); newUserItem.group = new EntityItemStringType[] { OvalHelper.CreateItemEntityWithStringValue("g1") }; } return(newUserItem); }
private void AssertGeneratedItemStatusAndMessageType(ItemType itemToAssert, StatusEnumeration expectedItemStatus, string expectedMessage) { Assert.AreEqual(expectedItemStatus, itemToAssert.status, "A generated item with unexpected status was found."); var itemMessage = itemToAssert.message; if (expectedItemStatus == StatusEnumeration.error) { Assert.IsNotNull(itemMessage, "The message type item entity cannot be null for items with 'Error' status"); Assert.IsFalse(string.IsNullOrEmpty(itemMessage.First().Value), "The message cannot be empty for items with 'Error' status"); } if ((!string.IsNullOrEmpty(expectedMessage)) && (itemMessage != null)) { Assert.IsTrue(itemMessage.First().Value.Contains(expectedMessage), "The exception message was not found in item type message."); } }
public static void DoBasicAssertForItems( IEnumerable<ItemType> itemsToAssert, int expectedItemsCount, Type expectedInstanceOfItems, StatusEnumeration expectedStatus = StatusEnumeration.exists) { Assert.IsNotNull(itemsToAssert, "There is no items."); Assert.AreEqual(expectedItemsCount, itemsToAssert.Count(), "Unexpected items count was found."); foreach (var item in itemsToAssert) { if (item.status != expectedStatus) { if (item.status == StatusEnumeration.error) Assert.Fail(ITEM_WITH_UNEXPECTED_ERROR_STATUS, expectedStatus, item.message.First().Value); else Assert.AreEqual(expectedStatus, item.status, UNEXPECTED_ITEM_STATUS_MSG); } Assert.IsInstanceOfType(item, expectedInstanceOfItems, UNEXPECTED_ITEM_INSTANCE_TYPE_MSG); } }
private void AssertGeneratedItemStatusAndMessageType(ItemType itemToAssert, StatusEnumeration expectedItemStatus, string expectedMessage) { Assert.AreEqual(expectedItemStatus, itemToAssert.status, "A generated item with unexpected status was found."); var itemMessage = itemToAssert.message; if (expectedItemStatus == StatusEnumeration.error) { Assert.IsNotNull(itemMessage, "The message type item entity cannot be null for items with 'Error' status"); Assert.IsFalse(string.IsNullOrEmpty(itemMessage.First().Value), "The message cannot be empty for items with 'Error' status"); } if ((!string.IsNullOrEmpty(expectedMessage)) && (itemMessage != null)) Assert.IsTrue(itemMessage.First().Value.Contains(expectedMessage), "The exception message was not found in item type message."); }
private void AssetUserItem(user_sid_item itemToAssert, string expectedUserSidValue, StatusEnumeration status) { }
public void SetRegistryKeyStatus(StatusEnumeration status) { ((registry_item)base.BuildingItemType).key.status = status; }
public registry_item CreateRegistryItem(string hive, string key, string name, StatusEnumeration status) { registry_item newRegistryItem = this.CreateRegistryItem(hive, key, name); newRegistryItem.status = status; return newRegistryItem; }
private void AssertTextFileContentItem(textfilecontent_item textFileContentItem, string expectedValueForLineEntity, StatusEnumeration expectedCollectedObjectStatus) { var assertStatusFailedMessage = string.Format("The status must be '{0}'", expectedCollectedObjectStatus.ToString()); Assert.AreEqual(expectedCollectedObjectStatus, textFileContentItem.status, assertStatusFailedMessage); if (!string.IsNullOrEmpty(expectedValueForLineEntity)) { Assert.IsNotNull(textFileContentItem.line, "The line entity cannot be null."); Assert.AreEqual(expectedValueForLineEntity, textFileContentItem.line.Value, "Unexpected value for line entity was found."); } }
protected void SetEntityStatus(EntityItemSimpleBaseType entity, StatusEnumeration status) { entity.status = status; }
private void DoBasicAssertForXmlFileContentCollectedItems(CollectedItem[] collectedItems, StatusEnumeration expectedStatus) { var collectedItemType = collectedItems.Single().ItemType; var withExistsStatus = expectedStatus == StatusEnumeration.exists; var expectedType = typeof(xmlfilecontent_item); ItemTypeChecker.DoBasicAssertForCollectedItems(collectedItems, 1, expectedType, withExistsStatus); if (expectedStatus == StatusEnumeration.error) { ItemTypeChecker.AssertItemTypeWithErrorStatus(collectedItemType, "XmlFileContentObjectCollector"); } else { Assert.AreEqual(expectedStatus, collectedItemType.status, "Unexpected collected item status was found."); } var filepathEntity = ((xmlfilecontent_item)collectedItemType).filepath; var xpathEntity = ((xmlfilecontent_item)collectedItemType).xpath; ItemTypeEntityChecker.AssertItemTypeEntity(filepathEntity, "c:\\temp"); ItemTypeEntityChecker.AssertItemTypeEntity(xpathEntity, "//generator/product_name"); }
public ItemType CreateFileItemTypesWithError(string path, string fileName, string trustee, string message, StatusEnumeration status) { ItemType itemType = this.CreateItemTypeForCollect(path, fileName, trustee); itemType.message = MessageType.FromErrorString(message); itemType.status = status; return(itemType); }
public EntityItemFieldType() { this.datatypeField = "string"; this.maskField = false; this.statusField = StatusEnumeration.exists; }
public ItemType() { this.statusField = StatusEnumeration.exists; }
public void SetRegistryNameStatus(StatusEnumeration status) { ((registry_item)base.BuildingItemType).name.status = status; }
private void AssertItemType(ItemType collectedItem, StatusEnumeration expectedItemStatus) { Assert.IsNotNull(collectedItem, "The collected item type cannot be null."); Assert.IsInstanceOfType(collectedItem, typeof(fileauditedpermissions_item), "Unexpected item type instance type was found."); Assert.AreEqual(expectedItemStatus, collectedItem.status, "Unexpected item type status was found."); }
private void DoBasicAssertForXmlFileContentCollectedItems(CollectedItem[] collectedItems, StatusEnumeration expectedStatus) { var collectedItemType = collectedItems.Single().ItemType; var withExistsStatus = expectedStatus == StatusEnumeration.exists; var expectedType = typeof(xmlfilecontent_item); ItemTypeChecker.DoBasicAssertForCollectedItems(collectedItems, 1, expectedType, withExistsStatus); if (expectedStatus == StatusEnumeration.error) ItemTypeChecker.AssertItemTypeWithErrorStatus(collectedItemType, "XmlFileContentObjectCollector"); else Assert.AreEqual(expectedStatus, collectedItemType.status, "Unexpected collected item status was found."); var filepathEntity = ((xmlfilecontent_item)collectedItemType).filepath; var xpathEntity = ((xmlfilecontent_item)collectedItemType).xpath; ItemTypeEntityChecker.AssertItemTypeEntity(filepathEntity, "c:\\temp"); ItemTypeEntityChecker.AssertItemTypeEntity(xpathEntity, "//generator/product_name"); }
public registry_item CreateRegistryItem(string hive, string key, string name, StatusEnumeration status) { registry_item newRegistryItem = this.CreateRegistryItem(hive, key, name); newRegistryItem.status = status; return(newRegistryItem); }
public EntityItemComplexBaseType() { this.datatypeField = ComplexDatatypeEnumeration.record; this.maskField = false; this.statusField = StatusEnumeration.exists; }
private fileeffectiverights_item CreateItemToCollect( string filepath, string trusteeSID, StatusEnumeration status = StatusEnumeration.exists) { return new fileeffectiverights_item() { filepath = OvalHelper.CreateItemEntityWithStringValue(filepath), path = OvalHelper.CreateItemEntityWithStringValue(Path.GetDirectoryName(filepath)), filename = OvalHelper.CreateItemEntityWithStringValue(Path.GetFileName(filepath)), trustee_name = OvalHelper.CreateItemEntityWithStringValue("sid") }; }
public void SetItemTypeEntityStatus(EntityItemStringType entityItemStringType, StatusEnumeration statusEnumeration) { entityItemStringType.status = statusEnumeration; }
public void SetGroupEntityStatus(EntityItemSimpleBaseType groupNameEntity, StatusEnumeration status) { groupNameEntity.status = status; if ((status == StatusEnumeration.doesnotexist) || (status == StatusEnumeration.error)) groupNameEntity.Value = string.Empty; }
public EntityItemSimpleBaseType() { this.datatypeField = SimpleDatatypeEnumeration.@string; this.maskField = false; this.statusField = StatusEnumeration.exists; }
private void SetTrusteeSIDEntityStatus(sid_sid_item sidsidItem, StatusEnumeration status) { sidsidItem.trustee_sid.status = status; if (status.Equals(StatusEnumeration.doesnotexist) || status.Equals(StatusEnumeration.error)) sidsidItem.trustee_sid.Value = string.Empty; }