Ejemplo n.º 1
0
        public static PropertyMustBe <T, string> MustBe <T>(this PropertyMustBe <T, string> actual, string expected, Case @case)
        {
            switch (@case)
            {
            case Case.Sensitive:
                return(actual.ValidateWith(expected).Is(EqualSensitive));

            case Case.Insensitive:
                return(actual.ValidateWith(expected).Is(EqualInsensitive));

            default:
                throw new ArgumentOutOfRangeException(nameof(@case), @case, null);
            }
        }
 public static PropertyMustBe <T, TProp> MustBe <T, TProp>(this PropertyMustBe <T, TProp> actual, TProp expected)
 {
     return(actual.ValidateWith(expected).Is(Is.Equal));
 }
 public static PropertyMustBe <T, bool?> MustBeFalse <T>(this PropertyMustBe <T, bool?> actual)
 {
     return(actual.ValidateWith(false).Is(Is.Equal));
 }
 public static PropertyMustBe <T, bool> MustBeTrue <T>(this PropertyMustBe <T, bool> actual)
 {
     return(actual.ValidateWith(true).Is(Is.Equal));
 }
Ejemplo n.º 5
0
 public static PropertyMustBe <T, IList <TProp> > MustBeEmpty <T, TProp>(this PropertyMustBe <T, IList <TProp> > actual)
 {
     return(actual.ValidateWith(actual.Value).Is(x => x == null || !x.Any()));
 }
Ejemplo n.º 6
0
 public static PropertyMustBe <T, TProp[]> MustNotBeEmpty <T, TProp>(this PropertyMustBe <T, TProp[]> actual)
 {
     return(actual.ValidateWith(actual.Value).Is(x => x != null && x.Any()));
 }
Ejemplo n.º 7
0
 public static PropertyMustBe <T, TProp> MustBeOneOf <T, TProp>(this PropertyMustBe <T, TProp> actual, params TProp[] expected)
 {
     return(actual.ValidateWith(expected).Is(Enumerable.Contains));
 }