本文整理汇总了C#中NumberCheck类的典型用法代码示例。如果您正苦于以下问题:C# NumberCheck类的具体用法?C# NumberCheck怎么用?C# NumberCheck使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NumberCheck类属于命名空间,在下文中一共展示了NumberCheck类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetEvenNumbers
/**
* TODO 3:
* Create a function called GetEvenNumbers which uses an instance of a NumberCheck delegate and an aray list of integers.
* The function will return a list with the even numbers.
*/
//IEnumerable merge cu yield; List nu merge
public static IEnumerable<int> GetEvenNumbers(NumberCheck function, List<int> list)
{
//var newList = new List<int>();
foreach (var number in list)
{
if (function(number))
{
//newList.Add(number);
yield return number;
}
}
//return newList;
}
示例2: IsNegative
public static ICheckLink<ICheck<float>> IsNegative(this ICheck<float> check)
{
var numberCheckStrategy = new NumberCheck<float>(check);
return numberCheckStrategy.IsStrictlyNegative();
}
示例3: IsPositiveOrZero
/// <summary>
/// Checks that the actual value is positive or equal to zero.
/// </summary>
/// <param name="check">The fluent check to be extended.</param>
/// <returns>
/// A check link.
/// </returns>
/// <exception cref="FluentCheckException">The value is not positive or equal to zero.</exception>
public static ICheckLink<ICheck<float>> IsPositiveOrZero(this ICheck<float> check)
{
var numberCheckStrategy = new NumberCheck<float>(check);
return numberCheckStrategy.IsPositiveOrZero();
}
示例4: IsZero
/// <summary>
/// Checks that the actual value is equal to zero.
/// </summary>
/// <param name="check">The fluent check to be extended.</param>
/// <returns>
/// A check link.
/// </returns>
/// <exception cref="FluentCheckException">The value is not equal to zero.</exception>
public static ICheckLink<ICheck<ushort>> IsZero(this ICheck<ushort> check)
{
var numberCheckStrategy = new NumberCheck<ushort>(check);
return numberCheckStrategy.IsZero();
}
示例5: IsStrictlyGreaterThan
/// <summary>
/// Checks that the checked value is strictly greater than the comparand.
/// </summary>
/// <param name="check">
/// The fluent check to be extended.
/// </param>
/// <param name="comparand">
/// Comparand to compare the value to.
/// </param>
/// <returns>
/// A check link.
/// </returns>
/// <exception cref="FluentCheckException">
/// The checked value is not strictly greater than the comparand.
/// </exception>
public static ICheckLink<ICheck<ushort>> IsStrictlyGreaterThan(this ICheck<ushort> check, ushort comparand)
{
var numberCheckStrategy = new NumberCheck<ushort>(check);
return numberCheckStrategy.IsStrictlyGreaterThan(comparand);
}
示例6: IsGreaterThan
public static ICheckLink<ICheck<float>> IsGreaterThan(this ICheck<float> check, float comparand)
{
var numberCheckStrategy = new NumberCheck<float>(check);
return numberCheckStrategy.IsGreaterThan(comparand);
}
示例7: IsStrictlyLessThan
/// <summary>
/// Checks that the checked value is strictly less than the comparand.
/// </summary>
/// <param name="check">
/// The fluent check to be extended.
/// </param>
/// <param name="comparand">
/// Comparand to compare the value to.
/// </param>
/// <returns>
/// A check link.
/// </returns>
/// <exception cref="FluentCheckException">
/// The value is not strictly less than the comparand.
/// </exception>
public static ICheckLink<ICheck<long>> IsStrictlyLessThan(this ICheck<long> check, long comparand)
{
var numberCheckStrategy = new NumberCheck<long>(check);
return numberCheckStrategy.IsStrictlyLessThan(comparand);
}
示例8: IsStrictlyPositive
/// <summary>
/// Checks that the actual value is strictly positive.
/// </summary>
/// <param name="check">The fluent check to be extended.</param>
/// <returns>
/// A check link.
/// </returns>
/// <exception cref="FluentCheckException">The value is not strictly positive.</exception>
public static ICheckLink<ICheck<decimal>> IsStrictlyPositive(this ICheck<decimal> check)
{
var numberCheckStrategy = new NumberCheck<decimal>(check);
return numberCheckStrategy.IsStrictlyPositive();
}
示例9: IsStrictlyGreaterThan
/// <summary>
/// Checks that the checked value is strictly greater than the comparand.
/// </summary>
/// <param name="check">
/// The fluent check to be extended.
/// </param>
/// <param name="comparand">
/// Comparand to compare the value to.
/// </param>
/// <returns>
/// A check link.
/// </returns>
/// <exception cref="FluentCheckException">
/// The checked value is not strictly greater than the comparand.
/// </exception>
public static ICheckLink<ICheck<double>> IsStrictlyGreaterThan(this ICheck<double> check, double comparand)
{
var numberCheckStrategy = new NumberCheck<double>(check);
return numberCheckStrategy.IsStrictlyGreaterThan(comparand);
}
示例10: IsGreaterThan
/// <summary>
/// Checks that the actual value is more than an operand.
/// </summary>
/// <param name="check">
/// The fluent check to be extended.
/// </param>
/// <param name="comparand">
/// Comparand to compare the value to.
/// </param>
/// <returns>
/// A check link.
/// </returns>
/// <exception cref="FluentCheckException">
/// The value is not less than the comparand.
/// </exception>
public static ICheckLink<ICheck<decimal>> IsGreaterThan(this ICheck<decimal> check, decimal comparand)
{
var numberCheckStrategy = new NumberCheck<decimal>(check);
return numberCheckStrategy.IsGreaterThan(comparand);
}
示例11: IsLessThan
public static ICheckLink<ICheck<byte>> IsLessThan(this ICheck<byte> check, byte comparand)
{
var numberCheckStrategy = new NumberCheck<byte>(check);
return numberCheckStrategy.IsLessThan(comparand);
}
示例12: IsLessThan
public static ICheckLink<ICheck<short>> IsLessThan(this ICheck<short> check, short comparand)
{
var numberCheckStrategy = new NumberCheck<short>(check);
return numberCheckStrategy.IsLessThan(comparand);
}
示例13: IsGreaterThan
public static ICheckLink<ICheck<ulong>> IsGreaterThan(this ICheck<ulong> check, ulong comparand)
{
var numberCheckStrategy = new NumberCheck<ulong>(check);
return numberCheckStrategy.IsGreaterThan(comparand);
}
示例14: IsPositive
#pragma warning disable 169
//// ---------------------- WARNING ----------------------
//// AUTO-GENERATED FILE WHICH SHOULD NOT BE MODIFIED!
//// To change this class, change the one that is used
//// as the golden source/model for this autogeneration
//// (i.e. the one dedicated to the integer values).
//// -----------------------------------------------------
// Since this class is the model/template for the generation of all the other signed numbers related CheckExtensions classes, don't forget to re-generate all the other classes every time you change this one. To do that, just save the ..\T4\NumberFluentAssertionGenerator.tt file within Visual Studio 2012. This will trigger the T4 code generation process.
/// <summary>
/// Checks that the actual value is strictly positive.
/// </summary>
/// <param name="check">The fluent check to be extended.</param>
/// <returns>
/// A check link.
/// </returns>
/// <exception cref="FluentCheckException">The value is not strictly positive.</exception>
public static ICheckLink<ICheck<short>> IsPositive(this ICheck<short> check)
{
var numberCheckStrategy = new NumberCheck<short>(check);
return numberCheckStrategy.IsPositive();
}
示例15: IsNegative
/// <summary>
/// Checks that the actual value is strictly negative.
/// </summary>
/// <param name="check">The fluent check to be extended.</param>
/// <returns>
/// A check link.
/// </returns>
/// <exception cref="FluentCheckException">The value is not strictly positive.</exception>
public static ICheckLink<ICheck<sbyte>> IsNegative(this ICheck<sbyte> check)
{
var numberCheckStrategy = new NumberCheck<sbyte>(check);
return numberCheckStrategy.IsNegative();
}