using System;
namespace Deltares.Standard.Specifications
{
///
/// Defines a greater then of equal to specification
///
/// The type of the candidate.
/// The type of the value.
public class GreaterThanOrEqualToSpecification : ValueBoundSpecification where TValue : IComparable
{
///
/// Initializes a new instance of the class.
///
/// Name of the attribute.
/// The attribute value.
public GreaterThanOrEqualToSpecification(string attributeName, TValue attributeValue)
: base(attributeName, attributeValue)
{
}
///
/// Determines whether the candidate satisfies the specification.
///
/// The candidate to test.
///
/// true if the candidate satisfies the specification otherwise, false.
///
public override bool IsSatisfiedBy(TCandidate candidate)
{
var actual = this.GetCandidateTValue(candidate) as IComparable;
return (actual.CompareTo(this.AttributeValue) >= 0);
}
}
}