Hi,
I tried using the IsCloseTo check with a float property and can't seem to get it to work. This may be more of a feature request, to make it support other data types. I don't know.
When I try running the below class the 'double property' works but the 'int property' and 'float property' don't. They fail with
TypeMock Verification: Call to TestDriver+TargetClass.set_IntProperty() Parameter: 1
value <4> is not is range 5 +/- 2
and
TypeMock Verification: Call to TestDriver+TargetClass.set_FloatProperty() Parameter: 1
value <0.4> is not is range 0.5 +/- 0.2
[TestFixture]
public class TestDriver
{
[Test]
public void DoubleTest () {
Mock mock = MockManager.Mock(typeof(TargetClass));
TargetClass target = new TargetClass();
mock.ExpectSet("DoubleProperty").Args(Check.IsCloseTo(0.5, 0.2));
target.DoubleProperty = 0.4;
}
[Test]
public void IntTest () {
Mock mock = MockManager.Mock(typeof(TargetClass));
TargetClass target = new TargetClass();
mock.ExpectSet("IntProperty").Args(Check.IsCloseTo(5, 2));
target.IntProperty = 4;
}
[Test]
public void FloatTest () {
Mock mock = MockManager.Mock(typeof(TargetClass));
TargetClass target = new TargetClass();
mock.ExpectSet("FloatProperty").Args(Check.IsCloseTo(0.5, 0.2));
target.FloatProperty = 0.4F;
}
public class TargetClass {
public double DoubleProperty { set { } }
public int IntProperty { set { } }
public float FloatProperty { set { } }
}
}
I'm using .net 1.1 and TypeMock 3.01
Thanks,
Colin Gravill