public IEnumerable <ValidationError> Validate(FeedItem feedItem)
        {
            if (feedItem == null)
            {
                throw new ArgumentNullException(nameof(feedItem));
            }

            if (!(feedItem is EmFeed emItem))
            {
                throw new ArgumentException($"Item is not of Em type, real type is: {feedItem.GetType()}");
            }

            var validationErrors = new List <ValidationError>();

            if (emItem.Sedol == default(string))
            {
                validationErrors.Add(new ValidationError(emItem.SourceAccountId, $"{nameof(emItem.Sedol)} is empty!"));
            }

            if (emItem.AssetValue == default(int))
            {
                validationErrors.Add(new ValidationError(emItem.SourceAccountId, $"{nameof(emItem.AssetValue)} is empty!"));
            }

            return(validationErrors);
        }
Exemple #2
0
        public IEnumerable <ValidationError> Validate(FeedItem feedItem)
        {
            if (feedItem == null)
            {
                throw new ArgumentNullException(nameof(feedItem));
            }

            if (!(feedItem is DeltaOneFeed emItem))
            {
                throw new ArgumentException($"Item is not of Em type, real type is: {feedItem.GetType()}");
            }

            var validationErrors = new List <ValidationError>();

            if (emItem.Isin == default(int))
            {
                validationErrors.Add(new ValidationError(emItem.SourceAccountId, $"{nameof(emItem.Isin)} is empty!"));
            }

            if (emItem.MaturityDate == default(DateTime))
            {
                validationErrors.Add(new ValidationError(emItem.SourceAccountId, $"{nameof(emItem.MaturityDate)} is empty!"));
            }

            return(validationErrors);
        }