Exemplo n.º 1
0
        public int GetHashCode(IJsonCheckItem obj)
        {
            if (obj == null)
            {
                return(0);
            }

            unchecked
            {
                var hashCode = obj.Id?.GetHashCode() ?? 0;
                hashCode = (hashCode * 397) ^ obj.State.GetHashCode();
                hashCode = (hashCode * 397) ^ (obj.Name?.GetHashCode() ?? 0);
                hashCode = (hashCode * 397) ^ Instance.GetHashCode(obj.Pos);
                return(hashCode);
            }
        }
Exemplo n.º 2
0
        public bool Equals(IJsonCheckItem x, IJsonCheckItem y)
        {
            if (x == null && y != null)
            {
                return(false);
            }
            if (x != null && y == null)
            {
                return(false);
            }
            if (x == null)
            {
                return(true);
            }

            return(x.Id == y.Id &&
                   x.State == y.State &&
                   x.Name == y.Name &&
                   Instance.Equals(x.Pos, y.Pos));
        }
Exemplo n.º 3
0
        internal CheckItem(IJsonCheckItem json, string checkListId, TrelloAuthorization auth = null)
        {
            Id       = json.Id;
            _context = new CheckItemContext(Id, checkListId, auth);
            _context.Synchronized += Synchronized;

            _checkList = new Field <CheckList>(_context, nameof(CheckList));
            _checkList.AddRule(NotNullRule <CheckList> .Instance);
            _name = new Field <string>(_context, nameof(Name));
            _name.AddRule(NotNullOrWhiteSpaceRule.Instance);
            _position = new Field <Position>(_context, nameof(Position));
            _position.AddRule(NotNullRule <Position> .Instance);
            _position.AddRule(PositionRule.Instance);
            _state = new Field <CheckItemState?>(_context, nameof(State));
            _state.AddRule(NullableHasValueRule <CheckItemState> .Instance);
            _state.AddRule(EnumerationRule <CheckItemState?> .Instance);

            TrelloConfiguration.Cache.Add(this);

            _context.Merge(json);
        }