public void NewUserElementFieldIndex_ShouldCreate()
 {
     var user = new User("Email");
     
     var resourcePool = new ResourcePool(user, "CMRP");
     
     var newIndex = resourcePool
         .AddElement("Element")
         .AddField("Field", ElementFieldDataType.Boolean, true)
         .EnableIndex(ElementFieldIndexSortType.HighestToLowest)
         .AddUserRating(user, 0);
 }
Beispiel #2
0
        public void NewUserElementFieldIndex_ShouldCreate()
        {
            var user = new User("User", "*****@*****.**");

            var resourcePool = new ResourcePool(user, "CMRP");

            var newIndex = resourcePool
                           .AddElement("Element")
                           .AddField("Field", ElementFieldDataType.Boolean, true)
                           .EnableIndex(ElementFieldIndexSortType.HighestToLowest)
                           .AddUserRating(0);
        }
Beispiel #3
0
        public void NewUserElementFieldIndex_ShouldCreate()
        {
            var user = new User("User", "*****@*****.**");

            var resourcePool = new ResourcePool(user, "CMRP");

            resourcePool
            .AddElement("Element")
            .AddField("Field", ElementFieldDataType.Decimal, true)
            .EnableIndex()
            .AddUserRating(0);
        }
Beispiel #4
0
        private static ResourcePool CreateDefaultResourcePool(User user, string resourcePoolName, string mainElementName, bool addImportanceIndex, int numberOfItems)
        {
            // Resource pool, main element, fields
            var resourcePool = new ResourcePool(user, resourcePoolName)
            {
                InitialValue = 100
            };

            // Main element
            var element = resourcePool.AddElement(mainElementName);

            element.IsMainElement = true;

            // Importance field
            ElementField importanceField = null;

            if (addImportanceIndex)
            {
                importanceField = element.AddField("Importance Field", ElementFieldDataType.Decimal, false);
                importanceField.EnableIndex();
            }

            // Items, cells, user cells
            for (var i = 1; i <= numberOfItems; i++)
            {
                var itemName = $"Item {i}";

                var item = element.AddItem(itemName);

                if (addImportanceIndex)
                {
                    item.AddCell(importanceField);
                }
            }

            // Return
            return(resourcePool);
        }
        public ResourcePool CreateDefaultResourcePool(User user, string resourcePoolName, bool useFixedResourcePoolRate, string mainElementName, bool addDirectIncomeField, bool addMultiplierField, bool addImportanceIndex, int numberOfItems)
        {
            // Resource pool, main element, fields
            var resourcePool = new ResourcePool(user, resourcePoolName);

            if (useFixedResourcePoolRate)
            {
                resourcePool.UseFixedResourcePoolRate = true;
                resourcePool.AddUserResourcePool(10);
            }

            // Main element
            var element = resourcePool.AddElement(mainElementName);
            element.IsMainElement = true;

            // Resource pool field
            if (addDirectIncomeField)
                element.AddField("Direct Income", ElementFieldDataType.DirectIncome, true);

            // Multiplier field
            if (addMultiplierField)
                element.AddField("Multiplier", ElementFieldDataType.Multiplier);

            // Importance field
            ElementField importanceField = null;
            if (addImportanceIndex)
            {
                importanceField = element.AddField("Importance Field", ElementFieldDataType.Decimal, false);
                importanceField.EnableIndex();
            }

            // Items, cells, user cells
            for (var i = 1; i <= numberOfItems; i++)
            {
                var itemName = string.Format("Item {0}", i);

                var item = element.AddItem(itemName);

                if (addDirectIncomeField)
                    item.AddCell(element.DirectIncomeField).SetValue(100M); // Default value

                if (addMultiplierField)
                    item.AddCell(element.MultiplierField);

                if (addImportanceIndex)
                    item.AddCell(importanceField);
            }

            // Return
            return resourcePool;
        }
Beispiel #6
0
        static ResourcePool CreateDefaultResourcePool(User user, string resourcePoolName, bool useFixedResourcePoolRate, string mainElementName, bool addDirectIncomeField, bool addMultiplierField, bool addImportanceIndex, int numberOfItems)
        {
            // Resource pool, main element, fields
            var resourcePool = new ResourcePool(user, resourcePoolName);

            if (useFixedResourcePoolRate)
            {
                resourcePool.UseFixedResourcePoolRate = true;
                resourcePool.AddUserResourcePool(10);

                resourcePool.ResourcePoolRateTotal = 10; // Computed field
                resourcePool.ResourcePoolRateCount = 1;  // Computed field
            }

            // Main element
            var element = resourcePool.AddElement(mainElementName);

            element.IsMainElement = true;

            // Resource pool field
            if (addDirectIncomeField)
            {
                element.AddField("Direct Income", ElementFieldDataType.DirectIncome, true);
            }

            // Multiplier field
            if (addMultiplierField)
            {
                element.AddField("Multiplier", ElementFieldDataType.Multiplier);
            }

            // Importance field
            ElementField importanceField = null;

            if (addImportanceIndex)
            {
                importanceField = element.AddField("Importance Field", ElementFieldDataType.Decimal, false);
                importanceField.EnableIndex();
            }

            // Items, cells, user cells
            for (var i = 1; i <= numberOfItems; i++)
            {
                var itemName = string.Format("Item {0}", i);

                var item = element.AddItem(itemName);

                if (addDirectIncomeField)
                {
                    item.AddCell(element.DirectIncomeField).SetValue(100M); // Default value
                }
                if (addMultiplierField)
                {
                    item.AddCell(element.MultiplierField);
                }

                if (addImportanceIndex)
                {
                    item.AddCell(importanceField);
                }
            }

            // Return
            return(resourcePool);
        }