/// <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)); }
public void GetResultAsyncShouldReturnFailForNull(NotNull sut, [RuleContext] RuleContext context) { Assert.That(() => sut.GetResultAsync(null, context), Is.FailingValidationResult); }
public void GetResultAsyncShouldReturnPassForANonNullInteger(NotNull sut, [RuleContext] RuleContext context, int value) { Assert.That(() => sut.GetResultAsync(value, context), Is.PassingValidationResult); }
public void GetResultAsyncShouldReturnFailForANullInteger(NotNull sut, [RuleContext] RuleContext context) { int?value = null; Assert.That(() => sut.GetResultAsync(value, context), Is.FailingValidationResult); }