Beispiel #1
0
 /// <summary>
 /// Evaluate an equal constraint for <see cref="IComparable"/>.
 /// </summary>
 /// <param name="obj">The object the parameter should equal to</param>
 public T Equal(object obj)
 {
     obj = ConvertObjectTypeToMatch(obj);
     ArgManager.AddInArgument(Is.Equal(obj));
     return(default(T));
 }
Beispiel #2
0
 /// <summary>
 /// Evaluate a less-than constraint for <see cref="IComparable"/>.
 /// </summary>
 /// <param name="objToCompare">The object the parameter should be less than</param>
 public T LessThan(IComparable objToCompare)
 {
     objToCompare = ConvertObjectTypeToMatch(objToCompare);
     ArgManager.AddInArgument(Is.LessThan(objToCompare));
     return(default(T));
 }
Beispiel #3
0
 /// <summary>
 /// Evaluate a greater-than-or-equal constraint for <see cref="IComparable"/>.
 /// </summary>
 /// <param name="objToCompare">The object the parameter should be greater than or equal to</param>
 public T GreaterThanOrEqual(IComparable objToCompare)
 {
     objToCompare = ConvertObjectTypeToMatch(objToCompare);
     ArgManager.AddInArgument(Is.GreaterThanOrEqual(objToCompare));
     return(default(T));
 }
Beispiel #4
0
 /// <summary>
 /// Constrain the argument to validate according to regex pattern
 /// </summary>
 public string Like(string pattern)
 {
     ArgManager.AddInArgument(Text.Like(pattern));
     return(null);
 }
Beispiel #5
0
 /// <summary>
 /// Evaluate a not-same-as constraint.
 /// </summary>
 /// <param name="obj">The object the parameter should not be the same as.</param>
 public T NotSame(object obj)
 {
     ArgManager.AddInArgument(Is.NotSame(obj));
     return(default(T));
 }
Beispiel #6
0
 /// <summary>
 /// Constrain the argument to end with the specified string
 /// </summary>
 public string EndsWith(string end)
 {
     ArgManager.AddInArgument(Text.EndsWith(end));
     return(null);
 }
Beispiel #7
0
 /// <summary>
 /// Constrain the argument to contain the specified string
 /// </summary>
 public string Contains(string innerString)
 {
     ArgManager.AddInArgument(Text.Contains(innerString));
     return(null);
 }
Beispiel #8
0
 ///<summary>
 /// Determines that all elements of the specified collection are in the the parameter collection
 ///</summary>
 ///<param name="collection">The collection to compare against</param>
 ///<returns>The constraint which should be applied to the list parameter.</returns>
 public T ContainsAll(IEnumerable collection)
 {
     ArgManager.AddInArgument(List.ContainsAll(collection));
     return(default(T));
 }
Beispiel #9
0
 /// <summary>
 /// Constrain the argument to starts with the specified string
 /// </summary>
 /// <returns></returns>
 public string StartsWith(string start)
 {
     ArgManager.AddInArgument(Text.StartsWith(start));
     return(null);
 }
Beispiel #10
0
 /// <summary>
 /// Determines that an element of the parameter collections conforms to another AbstractConstraint.
 /// </summary>
 /// <param name="index">The zero-based index of the list element.</param>
 /// <param name="constraint">The constraint which should be applied to the list element.</param>
 public T Element(int index, AbstractConstraint constraint)
 {
     ArgManager.AddInArgument(List.Element(index, constraint));
     return(default(T));
 }
Beispiel #11
0
 /// <summary>
 /// Determines that the parameter collection has the specified number of elements.
 /// </summary>
 /// <param name="constraint">The constraint that should be applied to the collection count.</param>
 public T Count(AbstractConstraint constraint)
 {
     ArgManager.AddInArgument(List.Count(constraint));
     return(default(T));
 }
Beispiel #12
0
 /// <summary>
 /// Determines that the parameter collection is identical to the specified collection
 /// </summary>
 public T Equal(IEnumerable collection)
 {
     ArgManager.AddInArgument(List.Equal(collection));
     return(default(T));
 }
Beispiel #13
0
 /// <summary>
 /// Determines whatever the parameter is in the collection.
 /// </summary>
 public T OneOf(IEnumerable collection)
 {
     ArgManager.AddInArgument(List.OneOf(collection));
     return(default(T));
 }
Beispiel #14
0
 /// <summary>
 /// Determines whether the specified object is in the parameter.
 /// The parameter must be IEnumerable.
 /// </summary>
 /// <param name="obj">Obj.</param>
 /// <returns></returns>
 public T IsIn(object obj)
 {
     ArgManager.AddInArgument(List.IsIn(obj));
     return(default(T));
 }