30 using NUnit.Framework;
31 using NUnit.Framework.Constraints;
33 namespace OpenSim.Tests.Common
37 private Vector3 _baseValue;
38 private Vector3 _valueToBeTested;
42 _baseValue = baseValue;
52 public override bool Matches(
object valueToBeTested)
54 if (valueToBeTested == null)
56 throw new ArgumentException(
"Constraint cannot be used upon null values.");
58 if (valueToBeTested.GetType() != typeof (Vector3))
60 throw new ArgumentException(
"Constraint cannot be used upon non vector values.");
63 _valueToBeTested = (Vector3) valueToBeTested;
65 return (IsWithinDoubleConstraint(_valueToBeTested.X, _baseValue.X) &&
66 IsWithinDoubleConstraint(_valueToBeTested.Y, _baseValue.Y) &&
67 IsWithinDoubleConstraint(_valueToBeTested.Z, _baseValue.Z));
72 writer.WriteExpectedValue(
73 string.Format(
"A value {0} within tolerance of plus or minus {1}", _baseValue, _tolerance));
78 writer.WriteActualValue(_valueToBeTested);
override bool Matches(object valueToBeTested)
override void WriteDescriptionTo(MessageWriter writer)
override void WriteActualValueTo(MessageWriter writer)
VectorToleranceConstraint(Vector3 baseValue, double tolerance)