public void GetResultAsyncShouldReturnPassWithANonEmptyQueryable(NotEmpty <string> sut, [RuleContext] RuleContext context)
 {
     Assert.That(() => sut.GetResultAsync(new List <string> {
         "Foo", "Bar"
     }.AsQueryable(), context), Is.PassingValidationResult);
 }
 public void GetResultAsyncShouldReturnPassWithANonEmptyReadonlyCollection(NotEmpty <string> sut, [RuleContext] RuleContext context)
 {
     Assert.That(() => ((IRule <IReadOnlyCollection <string> >)sut).GetResultAsync(new List <string> {
         "Foo", "Bar"
     }, context), Is.PassingValidationResult);
 }
 public void GetResultAsyncShouldReturnFailWithAnEmptyQueryable(NotEmpty <string> sut, [RuleContext] RuleContext context)
 {
     Assert.That(() => sut.GetResultAsync(new List <string>().AsQueryable(), context), Is.FailingValidationResult);
 }
 public void GetResultAsyncShouldReturnFailWithAnEmptyReadonlyCollection(NotEmpty <string> sut, [RuleContext] RuleContext context)
 {
     Assert.That(() => ((IRule <IReadOnlyCollection <string> >)sut).GetResultAsync(new List <string>(), context), Is.FailingValidationResult);
 }
 /// <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));
 }
Example #6
0
 public void GetResultAsyncShouldReturnPassWithANonEmptyString(NotEmpty sut, [RuleContext] RuleContext context)
 {
     Assert.That(() => sut.GetResultAsync("Foo".AsQueryable(), context), Is.PassingValidationResult);
 }
Example #7
0
 public void GetResultAsyncShouldReturnFailWithAnEmptyString(NotEmpty sut, [RuleContext] RuleContext context)
 {
     Assert.That(() => sut.GetResultAsync(String.Empty, context), Is.FailingValidationResult);
 }
Example #8
0
 public void GetResultAsyncShouldReturnPassWithANonEmptyArray(NotEmpty sut, [RuleContext] RuleContext context)
 {
     Assert.That(() => sut.GetResultAsync(new [] { "Foo", "Bar" }, context), Is.PassingValidationResult);
 }