29 using NUnit.Framework;
30 using NUnit.Framework.Constraints;
32 namespace OpenSim.Tests.Common
36 private double _baseValue;
37 private double _valueToBeTested;
41 _baseValue = baseValue;
51 public override bool Matches(
object valueToBeTested)
53 if (valueToBeTested == null)
55 throw new ArgumentException(
"Constraint cannot be used upon null values.");
57 if (valueToBeTested.GetType() != typeof(
double))
59 throw new ArgumentException(
"Constraint cannot be used upon non double-values.");
62 _valueToBeTested = (double)valueToBeTested;
64 return IsWithinDoubleConstraint(_valueToBeTested, _baseValue);
69 writer.WriteExpectedValue(string.Format(
"A value {0} within tolerance of plus or minus {1}",_baseValue,_tolerance));
74 writer.WriteActualValue(_valueToBeTested);
override void WriteDescriptionTo(MessageWriter writer)
override void WriteActualValueTo(MessageWriter writer)
DoubleToleranceConstraint(double baseValue, double tolerance)
override bool Matches(object valueToBeTested)