コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PagingCriterion{TEntity}" /> class.
        /// </summary>
        /// <param name="skipCount">The number of entities to skip when this
        /// <see cref="PagingCriterion{TEntity}"/> is applied.</param>
        /// <param name="pageSize">The number of entities to take when this
        /// <see cref="PagingCriterion{TEntity}"/> is applied.</param>
        /// <exception cref="ArgumentOutOfRangeException"><para><paramref name="skipCount"/> is less
        /// then 0.</para><para>-or-</para><para><paramref name="pageSize"/> is less than 1.</para>
        /// </exception>
        public PagingCriterion(int skipCount, int pageSize)
        {
            ParameterValidation.IsGreaterThanOrEqualTo(skipCount, 0, nameof(skipCount));
            ParameterValidation.IsGreaterThan(pageSize, 0, nameof(pageSize));

            this.SkipCount = skipCount;
            this.PageSize  = pageSize;
        }
コード例 #2
0
        public void IsGreaterThan_OutOfRangeValue_ArgumentOutOfRangeException(
            [Values(0, -1, int.MinValue)] int value)
        {
            var ex = Assert.Throws <ArgumentOutOfRangeException>(
                () => ParameterValidation.IsGreaterThan(value, 0, TestParameterName));

            Assert.That(ex.ParamName, Is.EqualTo(TestParameterName));
        }
コード例 #3
0
 public void IsGreaterThan_InRangeValue_DoesNotThrow(
     [Values(1, 2, int.MaxValue)] int value)
 {
     Assert.DoesNotThrow(
         () => ParameterValidation.IsGreaterThan(value, 0, TestParameterName));
 }