示例#1
0
        /// <summary>
        /// Submits the specified <see cref="ActivityDataLog" /> as a new log record.
        /// </summary>
        /// <param name="dataLog">The <see cref="ActivityDataLog" />.</param>
        /// <returns><c>true</c> if submission was successful, <c>false</c> otherwise.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="dataLog" /> is null.</exception>
        /// <exception cref="DataLoggerMockException">An issue with the data log was detected.</exception>
        public bool Submit(ActivityDataLog dataLog)
        {
            if (dataLog == null)
            {
                throw new ArgumentNullException(nameof(dataLog));
            }

            if (Tables.ContainsKey(dataLog.TableName))
            {
                Tables[dataLog.TableName].Add(dataLog);
            }
            else
            {
                DataLoggerMockTable newTable = new DataLoggerMockTable(dataLog);
                Tables.Add(dataLog.TableName, newTable);
                TableAdded?.Invoke(this, new DataLoggerMockTableEventArgs(newTable));
            }
            return(true);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="DataLoggerMockTableEventArgs" /> class.
 /// </summary>
 /// <param name="table">The <see cref="DataLoggerMockTable" />.</param>
 public DataLoggerMockTableEventArgs(DataLoggerMockTable table)
 {
     Table = table;
 }