Пример #1
0
        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;
 }
Пример #3
0
 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;
     }
 }
Пример #4
0
        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;
        }
Пример #5
0
 public void SetGroupEntityStatus(EntityItemSimpleBaseType groupNameEntity, StatusEnumeration status)
 {
     groupNameEntity.status = status;
     if ((status == StatusEnumeration.doesnotexist) || (status == StatusEnumeration.error))
     {
         groupNameEntity.Value = string.Empty;
     }
 }
Пример #6
0
 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;
     }
 }
Пример #7
0
        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;
        }
Пример #8
0
 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;
     }
 }
Пример #9
0
 /// <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();
     }
 }
Пример #10
0
 /// <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();
     }
 }
Пример #11
0
        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;
            }
        }
Пример #12
0
        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;
            }
        }
Пример #13
0
 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")
     });
 }
Пример #14
0
 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;
 }
Пример #15
0
 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())));
 }
Пример #16
0
        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;
        }
Пример #17
0
        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);
        }
Пример #18
0
        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.");
            }
        }
Пример #19
0
        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);
            }
        }
Пример #20
0
        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.");
        }
Пример #21
0
 private void AssetUserItem(user_sid_item itemToAssert, string expectedUserSidValue, StatusEnumeration status)
 {
 }
Пример #22
0
 public void SetRegistryKeyStatus(StatusEnumeration status)
 {
     ((registry_item)base.BuildingItemType).key.status = status;
 }
 private void AssetUserItem(user_sid_item itemToAssert, string expectedUserSidValue, StatusEnumeration status)
 {
 }
Пример #24
0
 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;
 }
Пример #25
0
        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.");
            }
        }
Пример #26
0
 public void SetRegistryKeyStatus(StatusEnumeration status)
 {
     ((registry_item)base.BuildingItemType).key.status = status;
 }
Пример #27
0
 protected void SetEntityStatus(EntityItemSimpleBaseType entity, StatusEnumeration status)
 {
     entity.status = status;
 }
Пример #28
0
        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");
        }
Пример #29
0
        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);
        }
Пример #30
0
        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.");
            }
        }
Пример #31
0
 public EntityItemFieldType() {
     this.datatypeField = "string";
     this.maskField = false;
     this.statusField = StatusEnumeration.exists;
 }
Пример #32
0
 public ItemType() {
     this.statusField = StatusEnumeration.exists;
 }
Пример #33
0
 public void SetRegistryNameStatus(StatusEnumeration status)
 {
     ((registry_item)base.BuildingItemType).name.status = status;
 }
Пример #34
0
 public EntityItemFieldType()
 {
     this.datatypeField = "string";
     this.maskField     = false;
     this.statusField   = StatusEnumeration.exists;
 }
 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");
        }
Пример #37
0
        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);
        }
Пример #38
0
 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")
     };
 }
Пример #40
0
 protected void SetEntityStatus(EntityItemSimpleBaseType entity, StatusEnumeration status)
 {
     entity.status = status;
 }
 public void SetItemTypeEntityStatus(EntityItemStringType entityItemStringType, StatusEnumeration statusEnumeration)
 {
     entityItemStringType.status = statusEnumeration;
 }
 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.");
 }
Пример #43
0
 public void SetGroupEntityStatus(EntityItemSimpleBaseType groupNameEntity, StatusEnumeration status)
 {
     groupNameEntity.status = status;
     if ((status == StatusEnumeration.doesnotexist) || (status == StatusEnumeration.error))
         groupNameEntity.Value = string.Empty;
 }
Пример #44
0
 public EntityItemSimpleBaseType() {
     this.datatypeField = SimpleDatatypeEnumeration.@string;
     this.maskField = false;
     this.statusField = StatusEnumeration.exists;
 }
Пример #45
0
 public ItemType()
 {
     this.statusField = StatusEnumeration.exists;
 }
Пример #46
0
 public EntityItemSimpleBaseType()
 {
     this.datatypeField = SimpleDatatypeEnumeration.@string;
     this.maskField     = false;
     this.statusField   = StatusEnumeration.exists;
 }
Пример #47
0
 public void SetRegistryNameStatus(StatusEnumeration status)
 {
     ((registry_item)base.BuildingItemType).name.status = status;
 }
Пример #48
0
 public EntityItemComplexBaseType()
 {
     this.datatypeField = ComplexDatatypeEnumeration.record;
     this.maskField     = false;
     this.statusField   = StatusEnumeration.exists;
 }
 public void SetItemTypeEntityStatus(EntityItemStringType entityItemStringType, StatusEnumeration statusEnumeration)
 {
     entityItemStringType.status = statusEnumeration;
 }
Пример #50
0
 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;
 }