Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the SubStatementBuilder class, passing the
        /// mandatory objects.
        /// </summary>
        /// <param name="actor">Whom the Statement is about, as an Agent or Group Object.</param>
        /// <param name="verb">Action taken by the Actor.</param>
        /// <param name="statementObject"> Activity or Agent that is the Object of the SubStatement.</param>
        public SubStatementBuilder(Actor actor, Verb verb, StatementObject statementObject)
        {
            _actor           = actor;
            _verb            = verb;
            _statementObject = statementObject;

            _attachments = new List <Attachment>();
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the SubStatement class.
        /// </summary>
        /// <param name="actor">Whom the SubStatement is about, as an Agent or Group Object.</param>
        /// <param name="verb">Action taken by the Actor.</param>
        /// <param name="statementObject">Activity or Agent that is the Object of the SubStatement.</param>
        /// <param name="result">Result Object, further details representing a measured outcome.</param>
        /// <param name="context">Context that gives the SubStatement more meaning. Examples: a team the Actor is working with, altitude at which a scenario was attempted in a flight simulator.</param>
        /// <param name="timestamp">Timestamp of when the events described within this SubStatement occurred. Set by the LRS if not provided.</param>
        /// <param name="attachments">Headers for Attachments to the SubStatement</param>
        public SubStatement(
            Actor actor,
            Verb verb,
            StatementObject statementObject,
            Result result      = null,
            Context context    = null,
            DateTime?timestamp = null,
            IEnumerable <Attachment> attachments = null)
        {
            if (statementObject == null)
            {
                throw new ArgumentNullException(nameof(statementObject));
            }
            if (statementObject is SubStatement)
            {
                throw new ArgumentException("A substatement cannot contain a substatement as object", nameof(statementObject));
            }
            if (verb == null)
            {
                throw new ArgumentNullException(nameof(verb));
            }
            if (actor == null)
            {
                throw new ArgumentNullException(nameof(actor));
            }

            Actor           = actor;
            Verb            = verb;
            StatementObject = statementObject;

            Result    = result;
            Context   = context;
            Timestamp = timestamp;

            if (attachments != null && attachments.Any())
            {
                Attachments = attachments;
            }
        }
 /// <summary>
 /// Starts the creation of a SubStatement object.
 /// </summary>
 /// <param name="actor">Whom the SubStatement is about, as an Agent or Group Object.</param>
 /// <param name="verb">Action taken by the Actor.</param>
 /// <param name="statementObject">Activity or Agent that is the Object of the SubStatement.</param>
 /// <returns>A builder class that allows to fluently configure a SubStatement.</returns>
 public static ISubStatementBuilder CreateSubStatement(Actor actor, Verb verb, StatementObject statementObject)
 {
     if (statementObject is SubStatement)
     {
         throw new ArgumentException("A substatement cannot have a substatement as object");
     }
     return(new SubStatementBuilder(actor, verb, statementObject));
 }