This repository was archived by the owner on Dec 1, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +11
-1
lines changed
test/NJsonApiCore.Test/Configuration Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,13 @@ public IResourceMapping GetMapping(Type type)
5959 return mapping ;
6060 }
6161
62+ public IResourceMapping GetMapping ( string resourceType )
63+ {
64+ IResourceMapping mapping ;
65+ resourcesMappingsByResourceType . TryGetValue ( resourceType , out mapping ) ;
66+ return mapping ;
67+ }
68+
6269 public IResourceMapping GetMapping ( object objectGraph )
6370 {
6471 return GetMapping ( Reflection . GetObjectType ( objectGraph ) ) ;
Original file line number Diff line number Diff line change 11using Newtonsoft . Json ;
22using System ;
3- using System . Collections . Generic ;
43
54namespace NJsonApi
65{
@@ -12,6 +11,8 @@ public interface IConfiguration
1211
1312 IResourceMapping GetMapping ( Type type ) ;
1413
14+ IResourceMapping GetMapping ( string resourceType ) ;
15+
1516 IResourceMapping GetMapping ( object objectGraph ) ;
1617
1718 JsonSerializer GetJsonSerializer ( ) ;
Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ public void Creates_configuration_mapping()
2525 // Assert
2626 Assert . True ( conf . IsResourceRegistered ( typeof ( Post ) ) ) ;
2727 Assert . NotNull ( conf . GetMapping ( typeof ( Post ) ) ) ;
28+ Assert . NotNull ( conf . GetMapping ( "posts" ) ) ;
29+
2830 Assert . False ( conf . IsResourceRegistered ( typeof ( Author ) ) ) ;
2931 Assert . Null ( conf . GetMapping ( typeof ( Author ) ) ) ;
3032 }
You can’t perform that action at this time.
0 commit comments