private GenerateValidValue ( double overridingMinValue, double overridingMaxValue ) : double | ||
overridingMinValue | double | |
overridingMaxValue | double | |
리턴 | double |
public void Test_GenerateValue_WhenDouble_ShouldSet() { Type propertyType = typeof(double); IPropDef def = new PropDefFake { PropertyType = propertyType }; ValidValueGenerator valueGenerator = new ValidValueGeneratorDouble(def); object value = valueGenerator.GenerateValidValue(); Assert.IsNotNull(value); Assert.IsInstanceOf(typeof(double), value); Assert.AreNotEqual(valueGenerator.GenerateValidValue(), value); }
public void Test_GenerateValue_WhenDecimapAndRule_ShouldRetValidValue() { IPropDef def = new PropDefFake { PropertyType = typeof(double) }; def.AddPropRule(CreatePropRuleDouble(3.01, 7.0004)); ValidValueGenerator generator = new ValidValueGeneratorDouble(def); Assert.AreSame(typeof(double), def.PropertyType); Assert.IsNotEmpty(def.PropRules.OfType<PropRuleDouble>().ToList<PropRuleDouble>()); var propRule = def.PropRules.OfType<PropRuleDouble>().First<PropRuleDouble>(); Assert.AreEqual(3.01, propRule.MinValue); Assert.AreEqual(7.0004, propRule.MaxValue); var value = (double) generator.GenerateValidValue(); Assert.IsNotNull(value); Assert.GreaterOrEqual(value, 3.01); Assert.LessOrEqual(value, 7.0004); }