public UserResourcePool(ResourcePool resourcePool, decimal resourcePoolRate) : this()
        {
            Validations.ArgumentNullOrDefault(resourcePool, "resourcePool");

            ResourcePool     = resourcePool;
            ResourcePoolRate = resourcePoolRate;
        }
        public UserElementField(ElementField elementField, decimal rating)
            : this()
        {
            Validations.ArgumentNullOrDefault(elementField, nameof(elementField));

            ElementField = elementField;
            Rating       = rating;
        }
        public ElementItem(Element element, string name) : this()
        {
            Validations.ArgumentNullOrDefault(element, "element");
            Validations.ArgumentNullOrDefault(name, "name");

            Element = element;
            Name    = name;
        }
Beispiel #4
0
        public Element(Project project, string name) : this()
        {
            Validations.ArgumentNullOrDefault(project, nameof(project));
            Validations.ArgumentNullOrDefault(name, nameof(name));

            Project = project;
            Name    = name;
        }
Beispiel #5
0
        public Element(ResourcePool resourcePool, string name)
            : this()
        {
            Validations.ArgumentNullOrDefault(resourcePool, nameof(resourcePool));
            Validations.ArgumentNullOrDefault(name, nameof(name));

            ResourcePool = resourcePool;
            Name         = name;
        }
Beispiel #6
0
        public ElementCell(ElementField field, ElementItem item)
            : this()
        {
            Validations.ArgumentNullOrDefault(field, nameof(field));
            Validations.ArgumentNullOrDefault(item, nameof(item));

            ElementField = field;
            ElementItem  = item;
        }
Beispiel #7
0
        public ElementCell(ElementField field, ElementItem item)
            : this()
        {
            Validations.ArgumentNullOrDefault(field, "field");
            Validations.ArgumentNullOrDefault(item, "item");

            ElementField = field;
            ElementItem  = item;
        }
Beispiel #8
0
        public User(string userName, string email)
            : this()
        {
            Validations.ArgumentNullOrDefault(userName, nameof(userName));
            Validations.ArgumentNullOrDefault(email, nameof(email));

            UserName = userName;
            Email    = email;
        }
Beispiel #9
0
        public User(string userName, string email)
            : this()
        {
            Validations.ArgumentNullOrDefault(userName, nameof(userName));
            // TODO Valid email address check?
            Validations.ArgumentNullOrDefault(email, nameof(email));

            UserName = userName;
            Email    = email;
        }
        public ResourcePool(User user, string name, string key)
            : this()
        {
            Validations.ArgumentNullOrDefault(user, "user");
            Validations.ArgumentNullOrDefault(name, "name");
            Validations.ArgumentNullOrDefault(key, "key");

            User = user;
            Name = name;
            Key  = key;
        }
Beispiel #11
0
        public ResourcePool(User user, string name, string key)
            : this()
        {
            Validations.ArgumentNullOrDefault(user, nameof(user));
            Validations.ArgumentNullOrDefault(name, nameof(name));
            Validations.ArgumentNullOrDefault(key, nameof(key));

            User = user;
            Name = name;
            Key  = key;
        }
        public ElementCell AddCell(ElementField field)
        {
            Validations.ArgumentNullOrDefault(field, "field");

            if (ElementCellSet.Any(item => item.ElementField == field))
            {
                throw new Exception("An element item can't have more than one cell for the same field.");
            }

            var cell = new ElementCell(field, this);

            field.ElementCellSet.Add(cell);
            ElementCellSet.Add(cell);
            return(cell);
        }
Beispiel #13
0
        public ElementField(Element element, string name, ElementFieldDataType fieldType, byte sortOrder, bool useFixedValue) : this()
        {
            Validations.ArgumentNullOrDefault(element, nameof(element));
            Validations.ArgumentNullOrDefault(name, nameof(name));
            Validations.ArgumentNullOrDefault(sortOrder, nameof(sortOrder));

            // fixedValue fix: String and Element types can only be useFixedValue = true
            if (fieldType == ElementFieldDataType.String || fieldType == ElementFieldDataType.Element)
            {
                useFixedValue = true;
            }

            Element       = element;
            Name          = name;
            DataType      = (byte)fieldType;
            UseFixedValue = useFixedValue;
            SortOrder     = sortOrder;
        }
Beispiel #14
0
        // For classes and structs, except nullables
        private void Validate <T>(T test, bool isNullOrDefault = true)
        {
            try
            {
                Validations.ArgumentNullOrDefault(test, nameof(test));

                if (isNullOrDefault)
                {
                    Assert.Fail();
                }
            }
            catch (ArgumentNullOrDefaultException ex)
            {
                if (!isNullOrDefault)
                {
                    Assert.Fail();
                }

                Assert.IsTrue(ex.ParamName == "test");
            }
        }
Beispiel #15
0
        public ElementField(Element element, string name, ElementFieldDataType fieldType, byte sortOrder, bool?useFixedValue = null) : this()
        {
            Validations.ArgumentNullOrDefault(element, "element");
            Validations.ArgumentNullOrDefault(name, "name");
            Validations.ArgumentNullOrDefault(sortOrder, "sortOrder");

            // fixedValue fix + validations
            if (fieldType == ElementFieldDataType.Multiplier)
            {
                useFixedValue = false;
            }

            if ((fieldType == ElementFieldDataType.String ||
                 fieldType == ElementFieldDataType.Element) &&
                useFixedValue.HasValue)
            {
                throw new ArgumentException(string.Format("fixedValue cannot have a value for {0} type", fieldType), "fixedValue");
            }

            if ((fieldType != ElementFieldDataType.String &&
                 fieldType != ElementFieldDataType.Element) &&
                !useFixedValue.HasValue)
            {
                throw new ArgumentException(string.Format("fixedValue must have a value for {0} type", fieldType), "fixedValue");
            }

            if (fieldType == ElementFieldDataType.Multiplier &&
                useFixedValue.Value)
            {
                throw new ArgumentException("fixedValue cannot be true for Multiplier type", "fixedValue");
            }

            Element       = element;
            Name          = name;
            DataType      = (byte)fieldType;
            UseFixedValue = useFixedValue;
            SortOrder     = sortOrder;
        }
Beispiel #16
0
        public Role(string name) : this()
        {
            Validations.ArgumentNullOrDefault(name, nameof(name));

            Name = name;
        }
        public UserElementCell(ElementCell elementCell) : this()
        {
            Validations.ArgumentNullOrDefault(elementCell, "elementCell");

            ElementCell = elementCell;
        }