Ejemplo n.º 1
0
        public void RevokeNotifier_Timer_Callback_Should_Detact_Timer_Interval_Change()
        {
            //Arrange
            bool first          = true;
            var  revokeNotifier = new ServiceProxy.Caching.RevokeNotifier.RevokeNotifier(
                subLog,
                subRevokeListener,
                subFuncRevokeKeyIndexer,
                () => ChangeConfigFunc(ref first));

            RevokeNotifierConfig ChangeConfigFunc(ref bool isFirst)
            {
                if (isFirst)
                {
                    isFirst = false;
                    return(new RevokeNotifierConfig {
                        CleanupIntervalInSec = 1
                    });
                }

                return(new RevokeNotifierConfig {
                    CleanupIntervalInSec = 7
                });
            }

            //Act
            SpinForSeconds(2);

            //Asert
            Assert.AreEqual(7, revokeNotifier.TimerInterval);
        }
Ejemplo n.º 2
0
        public void RevokeNotifier_Timer_Callback_Should_Cleanup()
        {
            //Arrange
            var revokeNotifier = new ServiceProxy.Caching.RevokeNotifier.RevokeNotifier(
                subLog,
                subRevokeListener,
                subFuncRevokeKeyIndexer,
                () => new RevokeNotifierConfig
            {
                CleanupIntervalInSec = 1
            });

            //Act
            SpinForSeconds(2);

            //Asert
            subRevokeKeyIndexer.Received().Cleanup();
        }
Ejemplo n.º 3
0
        public void RevokeNotifier_On_Revoke_Event_Should_Be_Invoked()
        {
            //Arrange
            var rm             = new FakeRevokingManager();
            var key            = "key";
            var revokeNotifier = new ServiceProxy.Caching.RevokeNotifier.RevokeNotifier(
                subLog,
                rm,
                subFuncRevokeKeyIndexer,
                subFuncRevokeNotifierConfig);

            //Act
            rm.Revoke(key);

            SpinForSeconds(2);

            //Asert
            subRevokeKeyIndexer.Received(1).GetLiveRevokeesAndSafelyRemoveDeadOnes(key);
        }