@@ -8,22 +8,24 @@ public class ValidCode
88 {
99 private static readonly DiagnosticAnalyzer Analyzer = new AttributeAnalyzer ( ) ;
1010
11- [ TestCase ( "{value:bool}" , "bool" ) ]
12- [ TestCase ( "{value:datetime}" , "System.DateTime" ) ]
13- [ TestCase ( "{value:decimal}" , "decimal" ) ]
14- [ TestCase ( "{value:double}" , "double" ) ]
15- [ TestCase ( "{value:float}" , "float" ) ]
16- [ TestCase ( "{value:int}" , "int" ) ]
11+ [ TestCase ( "{value}" , "string" ) ]
12+ [ TestCase ( "{value?}" , "string" ) ]
13+ [ TestCase ( "{value:bool}" , "bool" ) ]
14+ [ TestCase ( "{value:datetime}" , "System.DateTime" ) ]
15+ [ TestCase ( "{value:decimal}" , "decimal" ) ]
16+ [ TestCase ( "{value:double}" , "double" ) ]
17+ [ TestCase ( "{value:float}" , "float" ) ]
18+ [ TestCase ( "{value:int}" , "int" ) ]
1719 [ TestCase ( "api/orders/{value:int:min(1)}" , "int" ) ]
1820 [ TestCase ( "api/orders/{value:int:max(1)}" , "int" ) ]
1921 [ TestCase ( "api/orders/{value:int:range(1,10)}" , "int" ) ]
2022 [ TestCase ( "api/orders/{value:int:required}" , "int" ) ]
21- [ TestCase ( "{value:long}" , "long" ) ]
23+ [ TestCase ( "{value:long}" , "long" ) ]
2224 [ TestCase ( "api/orders/{value:min(1)}" , "long" ) ]
2325 [ TestCase ( "api/orders/{value:max(1)}" , "long" ) ]
2426 [ TestCase ( "api/orders/{value:range(1,10)}" , "long" ) ]
2527 [ TestCase ( "api/orders/{value:required}" , "long" ) ]
26- [ TestCase ( "{value:guid}" , "System.Guid" ) ]
28+ [ TestCase ( "{value:guid}" , "System.Guid" ) ]
2729 [ TestCase ( "api/orders/{value:minlength(1)}" , "string" ) ]
2830 [ TestCase ( "api/orders/{value:maxlength(1)}" , "string" ) ]
2931 [ TestCase ( "api/orders/{value:length(1)}" , "string" ) ]
@@ -45,13 +47,13 @@ namespace ValidCode
4547 public class OrdersController : Controller
4648 {
4749 [HttpGet(""api/{value}"")]
48- public async Task<int> GetOrder(int value)
50+ public IActionResult GetValue(string value)
4951 {
50- return value;
52+ return this.Ok( value) ;
5153 }
5254 }
53- }" . AssertReplace ( "int " , type )
54- . AssertReplace ( "{value} " , parameter ) ;
55+ }" . AssertReplace ( "{value} " , parameter )
56+ . AssertReplace ( "string " , type ) ;
5557 AnalyzerAssert . Valid ( Analyzer , code ) ;
5658 }
5759 }
0 commit comments