コード例 #1
0
        public UserResourcePool(ResourcePool resourcePool, decimal resourcePoolRate) : this()
        {
            Validations.ArgumentNullOrDefault(resourcePool, "resourcePool");

            ResourcePool     = resourcePool;
            ResourcePoolRate = resourcePoolRate;
        }
コード例 #2
0
        public UserElementField(ElementField elementField, decimal rating)
            : this()
        {
            Validations.ArgumentNullOrDefault(elementField, nameof(elementField));

            ElementField = elementField;
            Rating       = rating;
        }
コード例 #3
0
        public ElementItem(Element element, string name) : this()
        {
            Validations.ArgumentNullOrDefault(element, "element");
            Validations.ArgumentNullOrDefault(name, "name");

            Element = element;
            Name    = name;
        }
コード例 #4
0
ファイル: Element.cs プロジェクト: forCrowd/Backbone
        public Element(Project project, string name) : this()
        {
            Validations.ArgumentNullOrDefault(project, nameof(project));
            Validations.ArgumentNullOrDefault(name, nameof(name));

            Project = project;
            Name    = name;
        }
コード例 #5
0
ファイル: Element.cs プロジェクト: nakanoer/WealthEconomy
        public Element(ResourcePool resourcePool, string name)
            : this()
        {
            Validations.ArgumentNullOrDefault(resourcePool, nameof(resourcePool));
            Validations.ArgumentNullOrDefault(name, nameof(name));

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

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

            ElementField = field;
            ElementItem  = item;
        }
コード例 #8
0
ファイル: User.cs プロジェクト: thenoelman/Backbone
        public User(string userName, string email)
            : this()
        {
            Validations.ArgumentNullOrDefault(userName, nameof(userName));
            Validations.ArgumentNullOrDefault(email, nameof(email));

            UserName = userName;
            Email    = email;
        }
コード例 #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;
        }
コード例 #10
0
        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;
        }
コード例 #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;
        }
コード例 #12
0
        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);
        }
コード例 #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;
        }
コード例 #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");
            }
        }
コード例 #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;
        }
コード例 #16
0
        public Role(string name) : this()
        {
            Validations.ArgumentNullOrDefault(name, nameof(name));

            Name = name;
        }
コード例 #17
0
        public UserElementCell(ElementCell elementCell) : this()
        {
            Validations.ArgumentNullOrDefault(elementCell, "elementCell");

            ElementCell = elementCell;
        }