public void CheckFloatArray_Test(int testCase) { NumericValidations _validations = new NumericValidations(); bool result; float[] outArray; switch (testCase) { case 0: result = _validations.CheckFloatArray("0,0,0", out outArray); Assert.IsTrue(result); Assert.IsTrue(Enumerable.SequenceEqual(outArray, new float[3] { 0, 0, 0 })); break; case 1: result = _validations.CheckFloatArray("0,a,0", out outArray); Assert.IsFalse(result); break; case 2: result = _validations.CheckFloatArray("-1,6,-12", out outArray); Assert.IsTrue(result); Assert.IsTrue(Enumerable.SequenceEqual(outArray, new float[3] { -1, 6, -12 })); break; } }
private static Error CreateValidationForMin(PropertyInfo property, object propertyValue, string rule) { switch (ValidationHelper.ExtractPropertyTypeName(property)) { case nameof(String): return(TextValidations.HasMin(property, propertyValue, rule)); case nameof(Double): case nameof(Decimal): case nameof(Int16): case nameof(Int32): case nameof(Int64): return(NumericValidations.HasMin(property, propertyValue, rule)); default: throw new PropertyTypeNotSupportedForRuleException(property.Name, property.PropertyType.Name, rule); } }