예제 #1
0
        /// <summary>Adds the daily data.</summary>
        /// <param name="theData">The data.</param>
        /// <exception cref="ArgumentNullException">theData - must not be null</exception>
        public void AddDailyData(Covid19DailyData theData)
        {
            if (theData == null)
            {
                throw new ArgumentNullException(nameof(theData), "must not be null");
            }

            this.Covid19Data.Add(theData);
        }
예제 #2
0
        /// <summary>
        ///     Check if the Collection already contains an data object similar to the parameter
        /// </summary>
        /// <param name="theData"></param>
        /// precondition: theData != null
        /// <returns>true, if the collection has a member that matches the parameter</returns>
        public bool ContainsSimilarData(Covid19DailyData theData)
        {
            if (theData == null)
            {
                throw new ArgumentNullException(nameof(theData), "cannot be null");
            }

            var containsSimilar =
                this.Covid19Data.Any(data => data.DataDate == theData.DataDate && data.State == theData.State);

            return(containsSimilar);
        }