コード例 #1
0
        /// <summary>
        /// Detaches the specified observer from this <see cref="MessageBoard"/> so that it will no
        /// longer receive notification updates.
        /// </summary>
        /// <param name="observer">The observer to detach from this <see cref="MessageBoard"/>.
        /// </param>
        /// <exception cref="ArgumentNullException"><paramref name="observer"/> is
        /// <see langword="null"/>.</exception>
        public void Detach(IMessageBoardObserver observer)
        {
            ParameterValidation.IsNotNull(observer, nameof(observer));

            this.observers.Remove(observer);
        }
コード例 #2
0
        public void TestNullValidationPass()
        {
            var testObject = new List <string>();

            ParameterValidation.IsNotNull(testObject, nameof(testObject));
        }
コード例 #3
0
        /// <inheritdoc/>
        public int GetValue(Orange input)
        {
            ParameterValidation.IsNotNull(input, nameof(input));

            return(input.Quality);
        }
コード例 #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ExitCommand"/> class.
        /// </summary>
        /// <param name="commandLoop">The <see cref="CommandLoop"/> that this
        /// <see cref="ExitCommand"/> will cause to exit.</param>
        /// <exception cref="ArgumentNullException"><paramref name="commandLoop"/> is
        /// <see langword="null"/>.</exception>
        public ExitCommand(CommandLoop commandLoop)
        {
            ParameterValidation.IsNotNull(commandLoop, nameof(commandLoop));

            this.commandLoop = commandLoop;
        }
コード例 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SortStrategyResolver{T}"/> class.
        /// </summary>
        /// <param name="sortStrategies">The keyed collection of available
        /// <see cref="ISortStrategy{T}"/> types.</param>
        /// <exception cref="ArgumentNullException"><paramref name="sortStrategies"/> is
        /// <see langword="null"/>.</exception>
        public SortStrategyResolver(IIndex <SortType, ISortStrategy <T> > sortStrategies)
        {
            ParameterValidation.IsNotNull(sortStrategies, nameof(sortStrategies));

            this.sortStrategies = sortStrategies;
        }
コード例 #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ImplicitArgumentConverter"/> class.
        /// </summary>
        /// <param name="implicitOperator">The <see cref="MethodInfo"/> which describes the implicit
        /// operator to use to convert an argument.</param>
        /// <exception cref="ArgumentNullException"><paramref name="implicitOperator"/> is
        /// <see langword="null"/>.</exception>
        public ImplicitArgumentConverter(MethodInfo implicitOperator)
        {
            ParameterValidation.IsNotNull(implicitOperator, nameof(implicitOperator));

            this.implicitOperator = implicitOperator;
        }
コード例 #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RobotCommand"/> class.
        /// </summary>
        /// <param name="robot">The <see cref="IRobot"/> that this <see cref="RobotCommand"/> will
        /// execute on.</param>
        /// <exception cref="ArgumentNullException"><paramref name="robot"/> is
        /// <see langword="null"/>.</exception>
        protected RobotCommand(IRobot robot)
        {
            ParameterValidation.IsNotNull(robot, nameof(robot));

            this.Robot = robot;
        }
コード例 #8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CommandResolver"/> class.
        /// </summary>
        /// <param name="commandFactory">The <see cref="CommandFactory"/> to use to create
        /// instances of <see cref="ICommand"/>.</param>
        /// <exception cref="ArgumentNullException"><paramref name="commandFactory"/> is
        /// <see langword="null"/>.</exception>
        public CommandResolver(CommandFactory commandFactory)
        {
            ParameterValidation.IsNotNull(commandFactory, nameof(commandFactory));

            this.commandFactory = commandFactory;
        }
コード例 #9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ParameterTypeFavoringConstructorQuery"/>
        /// class.
        /// </summary>
        /// <param name="parameterTypes">An array of <see cref="Type"/> objects representing the
        /// number, order, and type of the parameters for the desired constructor.</param>
        /// <exception cref="ArgumentNullException"><paramref name="parameterTypes"/> is
        /// <see langword="null"/>.</exception>
        public ParameterTypeFavoringConstructorQuery(params Type[] parameterTypes)
        {
            ParameterValidation.IsNotNull(parameterTypes, nameof(parameterTypes));

            this.parameterTypes = parameterTypes;
        }
コード例 #10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ConnectionStringDbContextFactory" /> class
        /// which will use the specified connection string factory.
        /// </summary>
        /// <param name="connectionStringFactory">The factory to create a connection string from.
        /// </param>
        /// <exception cref="ArgumentNullException"><paramref name="connectionStringFactory"/> is
        /// <see langword="null"/>.</exception>
        public ConnectionStringDbContextFactory(Func <string> connectionStringFactory)
        {
            ParameterValidation.IsNotNull(connectionStringFactory, nameof(connectionStringFactory));

            this.connectionStringFactory = connectionStringFactory;
        }
コード例 #11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FacadeExample"/> class.
        /// </summary>
        /// <param name="goldMine">The <see cref="GoldMine"/> to use in this example.</param>
        public FacadeExample(GoldMine goldMine)
        {
            ParameterValidation.IsNotNull(goldMine, nameof(goldMine));

            this.goldMine = goldMine;
        }
コード例 #12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DataModule"/> class which will use
        /// the specified connection string factory.
        /// </summary>
        /// <param name="connectionStringFactory">The connection string factory.</param>
        /// <exception cref="ArgumentNullException"><paramref name="connectionStringFactory"/> is
        /// <see langword="null"/>.</exception>
        public DataModule(IConnectionStringFactory connectionStringFactory)
        {
            ParameterValidation.IsNotNull(connectionStringFactory, nameof(connectionStringFactory));

            this.connectionStringFactory = connectionStringFactory.CreateConnectionString;
        }
コード例 #13
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DataModule"/> class which will use
        /// the specified connection string factory.
        /// </summary>
        /// <param name="connectionStringFactory">The connection string factory.</param>
        /// <exception cref="ArgumentNullException"><paramref name="connectionStringFactory"/> is
        /// <see langword="null"/>.</exception>
        public DataModule(Func <string> connectionStringFactory)
        {
            ParameterValidation.IsNotNull(connectionStringFactory, nameof(connectionStringFactory));

            this.connectionStringFactory = connectionStringFactory;
        }