Exemple #1
0
        /// <summary>
        /// Creates a new instance of <see cref="LoadAssessmentSectionActivity"/>.
        /// </summary>
        /// <param name="assessmentSectionOwner">The owner to set the <see cref="AssessmentSection"/> on.</param>
        /// <param name="loadAssessmentSectionService">The service defining how to
        /// retrieve the <see cref="AssessmentSection"/> from a file.</param>
        /// <param name="filePath">The file path to retrieve the <see cref="AssessmentSection"/> from.</param>
        /// <exception cref="ArgumentNullException">Thrown when any of the arguments is <c>null</c>.</exception>
        public LoadAssessmentSectionActivity(AssessmentSectionOwner assessmentSectionOwner,
                                             ILoadAssessmentSectionService loadAssessmentSectionService,
                                             string filePath)
        {
            if (assessmentSectionOwner == null)
            {
                throw new ArgumentNullException(nameof(assessmentSectionOwner));
            }

            if (loadAssessmentSectionService == null)
            {
                throw new ArgumentNullException(nameof(loadAssessmentSectionService));
            }

            if (filePath == null)
            {
                throw new ArgumentNullException(nameof(filePath));
            }

            this.assessmentSectionOwner       = assessmentSectionOwner;
            this.loadAssessmentSectionService = loadAssessmentSectionService;
            this.filePath = filePath;

            Description = Resources.LoadAssessmentSectionActivity_Description;
        }
        /// <summary>
        /// Creates an activity to load an <see cref="AssessmentSection"/> from a file.
        /// </summary>
        /// <param name="owner">The owner to set the <see cref="AssessmentSection"/> on.</param>
        /// <param name="loadAssessmentSectionService">The service for retrieving the
        /// <see cref="AssessmentSection"/> from a file.</param>
        /// <param name="filePath">The file path to retrieve the <see cref="AssessmentSection"/> from.</param>
        /// <returns>The <see cref="Activity"/> to load <see cref="AssessmentSection"/> from a file.</returns>
        /// <exception cref="ArgumentNullException">Thrown when any of the arguments is <c>null</c>.</exception>
        public static Activity CreateLoadAssessmentSectionActivity(AssessmentSectionOwner owner,
                                                                   ILoadAssessmentSectionService loadAssessmentSectionService,
                                                                   string filePath)
        {
            if (owner == null)
            {
                throw new ArgumentNullException(nameof(owner));
            }

            if (loadAssessmentSectionService == null)
            {
                throw new ArgumentNullException(nameof(loadAssessmentSectionService));
            }

            if (filePath == null)
            {
                throw new ArgumentNullException(nameof(filePath));
            }

            return(new LoadAssessmentSectionActivity(owner, loadAssessmentSectionService, filePath));
        }