public async Task EvaluateAsync_NonEmptyEnumerable_ReturnsValid() { var rule = new NotEmptyRule <IEnumerable <string> >("foo"); var result = await rule.EvaluateAsync(new[] { "bar" }); Assert.True(result.IsValid); }
public async Task EvaluateAsync_NonEmptyGuid_ReturnsValid() { var rule = new NotEmptyRule <Guid>("foo"); var result = await rule.EvaluateAsync(Guid.NewGuid()); Assert.True(result.IsValid); }
public async Task EvaluateAsync_NonEmptyString_ReturnsValid() { var rule = new NotEmptyRule <string>("foo"); var result = await rule.EvaluateAsync("bar"); Assert.True(result.IsValid); }
public async Task EvaluateAsync_NullEnumerable_ReturnsError() { var rule = new NotEmptyRule <IEnumerable <string> >("foo"); var result = await rule.EvaluateAsync(null); Assert.False(result.IsValid); Assert.Equal("foo", result.Errors.Single().MemberName); }
public async Task EvaluateAsync_EmptyGuid_ReturnsError() { var rule = new NotEmptyRule <Guid>("foo"); var result = await rule.EvaluateAsync(Guid.Empty); Assert.False(result.IsValid); Assert.Equal("foo", result.Errors.Single().MemberName); }