Пример #1
0
        public void ReceiveIdempotencyServiceFindShouldReturnFalseIfValueNotPresent1()
        {
            IReceiveIdempotencyService <string> receiveIdempotencyService = new ReceiveIdempotencyService <string>(1 * 60000);

            Assert.IsFalse(receiveIdempotencyService.Find("Hello"));

            receiveIdempotencyService.Dispose();
        }
Пример #2
0
        public void ReceiveIdempotencyServiceFindShouldReturnTrueIfValuePresent()
        {
            IReceiveIdempotencyService <string> receiveIdempotencyService = new ReceiveIdempotencyService <string>(1 * 60000);

            receiveIdempotencyService.Add("Hello");
            Assert.IsTrue(receiveIdempotencyService.Find("Hello"));

            receiveIdempotencyService.Dispose();
        }
Пример #3
0
        public void ReceiveIdempotencyServiceShouldRemoveItemsWhenExpiryIsResumed()
        {
            IReceiveIdempotencyService <string> receiveIdempotencyService = new ReceiveIdempotencyService <string>(5 * 1000);

            receiveIdempotencyService.Add("Hello");

            receiveIdempotencyService.PausePacketExpiry();

            Thread.Sleep(10 * 1000);

            Assert.IsTrue(receiveIdempotencyService.Find("Hello"));

            receiveIdempotencyService.ResumePacketExpiry();

            Thread.Sleep(10 * 1000);

            Assert.IsFalse(receiveIdempotencyService.Find("Hello"));

            receiveIdempotencyService.Dispose();
        }