@@ -731,22 +731,30 @@ public async Task TestInitEmptyByInputStreamAsync()
731731 public void TestReloadPolicy ( )
732732 {
733733 Enforcer e = new ( "Examples/rbac_model.conf" , "Examples/rbac_policy.csv" ) ;
734-
735734 e . LoadPolicy ( ) ;
736- TestGetPolicy ( e ,
737- AsList ( AsList ( "alice" , "data1" , "read" ) , AsList ( "bob" , "data2" , "write" ) ,
738- AsList ( "data2_admin" , "data2" , "read" ) , AsList ( "data2_admin" , "data2" , "write" ) ) ) ;
735+ e . TestGetPolicy (
736+ [
737+ [ "alice" , "data1" , "read" ] ,
738+ [ "bob" , "data2" , "write" ] ,
739+ [ "data2_admin" , "data2" , "read" ] ,
740+ [ "data2_admin" , "data2" , "write" ]
741+ ]
742+ ) ;
739743 }
740744
741745 [ Fact ]
742746 public async Task TestReloadPolicyAsync ( )
743747 {
744748 Enforcer e = new ( "Examples/rbac_model.conf" , "Examples/rbac_policy.csv" ) ;
745-
746749 await e . LoadPolicyAsync ( ) ;
747- TestGetPolicy ( e ,
748- AsList ( AsList ( "alice" , "data1" , "read" ) , AsList ( "bob" , "data2" , "write" ) ,
749- AsList ( "data2_admin" , "data2" , "read" ) , AsList ( "data2_admin" , "data2" , "write" ) ) ) ;
750+ e . TestGetPolicy (
751+ [
752+ [ "alice" , "data1" , "read" ] ,
753+ [ "bob" , "data2" , "write" ] ,
754+ [ "data2_admin" , "data2" , "read" ] ,
755+ [ "data2_admin" , "data2" , "write" ]
756+ ]
757+ ) ;
750758 }
751759
752760 [ Fact ]
@@ -880,7 +888,7 @@ public void TestEnableAutoSave()
880888 // Reload the policy from the storage to see the effect.
881889 e . LoadPolicy ( ) ;
882890
883- Assert . True ( e . Enforce ( "alice" , "data1" , "read" ) ) ; // Will not be false here.
891+ Assert . True ( e . Enforce ( "alice" , "data1" , "read" ) ) ; // Will not be false here.
884892 Assert . False ( e . Enforce ( "alice" , "data1" , "write" ) ) ;
885893 Assert . False ( e . Enforce ( "alice" , "data2" , "read" ) ) ;
886894 Assert . False ( e . Enforce ( "alice" , "data2" , "write" ) ) ;
@@ -1068,22 +1076,21 @@ public async Task TestEnforceExApiAsync()
10681076 e . BuildRoleLinks ( ) ;
10691077
10701078 await e . TestEnforceExAsync ( "alice" , "data1" , "read" , new List < string > { "alice" , "data1" , "read" , "allow" } ) ;
1071- await e . TestEnforceExAsync ( "alice" , "data1" , "write" , new List < string > { "data1_deny_group" , "data1" , "write" , "deny" } ) ;
1079+ await e . TestEnforceExAsync ( "alice" , "data1" , "write" ,
1080+ new List < string > { "data1_deny_group" , "data1" , "write" , "deny" } ) ;
10721081 await e . TestEnforceExAsync ( "alice" , "data2" , "read" , new List < string > ( ) ) ;
10731082 await e . TestEnforceExAsync ( "alice" , "data2" , "write" , new List < string > ( ) ) ;
10741083 await e . TestEnforceExAsync ( "bob" , "data1" , "write" , new List < string > ( ) ) ;
1075- await e . TestEnforceExAsync ( "bob" , "data2" , "read" , new List < string > { "data2_allow_group" , "data2" , "read" , "allow" } ) ;
1084+ await e . TestEnforceExAsync ( "bob" , "data2" , "read" ,
1085+ new List < string > { "data2_allow_group" , "data2" , "read" , "allow" } ) ;
10761086 await e . TestEnforceExAsync ( "bob" , "data2" , "write" , new List < string > { "bob" , "data2" , "write" , "deny" } ) ;
10771087 }
10781088
10791089#if ! NET452
10801090 [ Fact ]
10811091 public void TestEnforceExApiLog ( )
10821092 {
1083- Enforcer e = new ( TestModelFixture . GetBasicTestModel ( ) )
1084- {
1085- Logger = new MockLogger < Enforcer > ( _testOutputHelper )
1086- } ;
1093+ Enforcer e = new ( TestModelFixture . GetBasicTestModel ( ) ) { Logger = new MockLogger < Enforcer > ( _testOutputHelper ) } ;
10871094
10881095 e . TestEnforceEx ( "alice" , "data1" , "read" , new List < string > { "alice" , "data1" , "read" } ) ;
10891096 e . TestEnforceEx ( "alice" , "data1" , "write" , new List < string > ( ) ) ;
0 commit comments