0
|
1 using System;
|
|
2
|
|
3 using NUnit.Framework;
|
|
4
|
|
5 using BLToolkit.Validation;
|
|
6
|
|
7 namespace Validation
|
|
8 {
|
|
9 [TestFixture]
|
|
10 public class MinValue
|
|
11 {
|
|
12 class Entity
|
|
13 {
|
|
14 [MinValue(1), Required]
|
|
15 public float Test { get; set; }
|
|
16 }
|
|
17
|
|
18 [Test]
|
|
19 public void Test()
|
|
20 {
|
|
21 /*
|
|
22 var nullValue = TypeAccessor.GetNullValue;
|
|
23 TypeAccessor.GetNullValue = type =>
|
|
24 {
|
|
25 if (type == typeof(float))
|
|
26 return float.MinValue;
|
|
27 else return nullValue(type);
|
|
28 };
|
|
29 */
|
|
30
|
|
31 var foo = new Entity();
|
|
32 Assert.AreEqual(false, Validator.IsValid(foo, "Test"));
|
|
33 }
|
|
34 }
|
|
35 }
|