Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }