public void ShouldUpdate() { var sampleWatcher = new SampleWatcher(); Assert.False(sampleWatcher.Called); var enforcer = new Enforcer(_testModelFixture.GetNewRbacTestModel(), new DefaultFileAdapter(TestModelFixture.GetTestFile("rbac_policy_for_watcher_test.csv"))); enforcer.SetWatcher(sampleWatcher, false); enforcer.SavePolicy(); Assert.True(sampleWatcher.Called); }
public async Task ShouldUpdateAsync() { var sampleWatcher = new SampleWatcher(); Assert.False(sampleWatcher.AsyncCalled); var enforcer = new Enforcer(_testModelFixture.GetBasicTestModel(), new DefaultFileAdapter(TestModelFixture.GetTestFile("rbac_policy_for_async_watcher_test.csv"))); enforcer.SetWatcher(sampleWatcher); await enforcer.SavePolicyAsync(); Assert.True(sampleWatcher.AsyncCalled); }