コード例 #1
0
 /// <summary>
 /// Initialises a new instance of <see cref="NotNullOrEmpty{T}"/>.
 /// </summary>
 /// <param name="notNull">A not-null rule.</param>
 /// <param name="notEmpty">A not-empty rule.</param>
 /// <exception cref="System.ArgumentNullException">If either constructor parameter is <see langword="null" />.</exception>
 public NotNullOrEmpty(NotNull notNull, NotEmpty <T> notEmpty)
 {
     this.notNull  = notNull ?? throw new System.ArgumentNullException(nameof(notNull));
     this.notEmpty = notEmpty ?? throw new System.ArgumentNullException(nameof(notEmpty));
 }
コード例 #2
0
 public void GetResultAsyncShouldReturnFailForNull(NotNull sut, [RuleContext] RuleContext context)
 {
     Assert.That(() => sut.GetResultAsync(null, context), Is.FailingValidationResult);
 }
コード例 #3
0
 public void GetResultAsyncShouldReturnPassForANonNullInteger(NotNull sut, [RuleContext] RuleContext context, int value)
 {
     Assert.That(() => sut.GetResultAsync(value, context), Is.PassingValidationResult);
 }
コード例 #4
0
        public void GetResultAsyncShouldReturnFailForANullInteger(NotNull sut, [RuleContext] RuleContext context)
        {
            int?value = null;

            Assert.That(() => sut.GetResultAsync(value, context), Is.FailingValidationResult);
        }