Example #1
0
        public void GetLiveRevokeesAndSafelyRemoveDeadOnes_Existing_Key_Should_Return_None_Empty_Enumerable()
        {
            // Arrange
            var rcc = new RevokeContextConcurrentCollection();
            var sub = Substitute.For <IRevokeContextConcurrentCollectionFactory>();

            sub.Create().Returns(_ => rcc);
            IRevokeContextConcurrentCollectionFactory subFunc = sub;
            var revokeKeyIndexer = new RevokeKeyIndexer(
                sub,
                this.subLog);;
            string revokeKey = "existing";

            revokeKeyIndexer.AddRevokeContext(revokeKey, CreateRevokeContextRooted());
            // Act
            var res = revokeKeyIndexer.GetLiveRevokeesAndSafelyRemoveDeadOnes(
                revokeKey);

            // Assert
            Assert.AreEqual(1, res.Count());
        }
Example #2
0
 public void SetUp()
 {
     this.subFunc = Substitute.For <IRevokeContextConcurrentCollectionFactory>();
     this.subLog  = Substitute.For <ILog>();
 }
 public RevokeKeyIndexer(IRevokeContextConcurrentCollectionFactory contextCollectionFactory, ILog log)
 {
     _log     = log;
     _entries = new ConcurrentDictionary <string, IRevokeContextConcurrentCollection>();
     _contextCollectionFactory = contextCollectionFactory;
 }