Esempio n. 1
0
        public TextTrait AddTextTrait(TraitName traitName, string traitValue = null)
        {
            if (_traits.Any(x => x.TraitName == traitName))
                throw new DuplicateNameException("Cannot add Trait.  Another trait with that name already exists.");

            var val = new TextTrait(traitName, traitValue);
            _traits.Add(val);
            return val;
        }
Esempio n. 2
0
        public NumericTrait AddNumericTrait(TraitName traitName, int traitValue = 0, int minVal = 0, int maxVal = 100)
        {
            if (_traits.Any(x => x.TraitName == traitName))
                throw new DuplicateNameException("Cannot add Trait.  Another trait with that name already exists.");

            var val = new NumericTrait(traitName, traitValue,minVal, maxVal);
            _traits.Add(val);
            return val;
        }
Esempio n. 3
0
        public void RemoveTraitByName(TraitName name)
        {
            var trait = _traits.SingleOrDefault(x => x.TraitName == name);
            if(trait ==null)
                throw new InstanceNotFoundException("Cannot find Trait by that name.");

            _traits.Remove(trait);
        }