Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Talk" /> class.
        /// </summary>
        /// <param name="title">The title.</param>
        /// <param name="durationInMinutes">The duration in minutes.</param>
        /// <exception cref="System.ArgumentException">The length of the talk cannot be more than an hour or less than 5 minutes.;startTime</exception>
        public Talk(string title, int durationInMinutes)
        {
            if (Talk.IsTooLong(durationInMinutes) || Talk.IsTooShort(durationInMinutes))
            {
                throw new ArgumentException("The length of the talk cannot be more than an hour or less than 5 minutes.", "duration");
            }

            if (!Talk.IsValidTitle(title))
            {
                throw new ArgumentException("The title of the talk is not valid.", "title");
            }

            this.Title    = title;
            this.Duration = durationInMinutes;
        }