root / trunk / hammock / src / net35 / Hammock.Tests / Attributes / Validation / BooleanToIntegerTests.cs @ 0eea575a
History | View | Annotate | Download (1 kB)
1 |
using Hammock.Attributes.Specialized; |
---|---|
2 |
using Hammock.Attributes.Validation; |
3 |
using Hammock.Web; |
4 |
using NUnit.Framework; |
5 |
|
6 |
namespace Hammock.Tests.Attributes.Validation |
7 |
{ |
8 |
[TestFixture] |
9 |
public class BooleanToIntegerTests |
10 |
{ |
11 |
public class BooleanToIntegerInfo : IWebQueryInfo |
12 |
{ |
13 |
[BooleanToInteger] |
14 |
[Parameter("Result")] |
15 |
public bool IShouldBeANumber { get; set; } |
16 |
} |
17 |
|
18 |
[Test] |
19 |
public void Can_use_boolean_to_integer_validation_to_transform_parameter_value() |
20 |
{ |
21 |
var info = new BooleanToIntegerInfo {IShouldBeANumber = false}; |
22 |
|
23 |
var client = new RestClient |
24 |
{ |
25 |
Authority = "http://nowhere.com", |
26 |
Info = info |
27 |
}; |
28 |
|
29 |
var request = new RestRequest |
30 |
{ |
31 |
Path = "fast" |
32 |
}; |
33 |
|
34 |
client.Request(request); |
35 |
} |
36 |
} |
37 |
} |