Exemple #1
0
        public void ReceiveIdempotencyServiceFindShouldReturnFalseIfValueNotPresent1()
        {
            IReceiveIdempotencyService <string> receiveIdempotencyService = new ReceiveIdempotencyService <string>(1 * 60000);

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

            receiveIdempotencyService.Dispose();
        }
Exemple #2
0
        public void ReceiveIdempotencyServiceShouldBeAbleToAdd()
        {
            IReceiveIdempotencyService <string> receiveIdempotencyService = new ReceiveIdempotencyService <string>(1 * 60000);

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

            receiveIdempotencyService.Dispose();
        }
Exemple #3
0
        public void ReceiveIdempotencyServiceFindShouldReturnTrueIfValuePresent()
        {
            IReceiveIdempotencyService <string> receiveIdempotencyService = new ReceiveIdempotencyService <string>(1 * 60000);

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

            receiveIdempotencyService.Dispose();
        }
Exemple #4
0
        public void ReceiveIdempotencyServiceShouldRemoveItemsAfterTimeout()
        {
            IReceiveIdempotencyService <string> receiveIdempotencyService = new ReceiveIdempotencyService <string>(5 * 1000);

            receiveIdempotencyService.Add("Hello");

            Thread.Sleep(10 * 1000);

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

            receiveIdempotencyService.Dispose();
        }
Exemple #5
0
        public void ReceiveIdempotencyServiceShouldNotRemoveItemsIfExpiryIsPaused()
        {
            IReceiveIdempotencyService <string> receiveIdempotencyService = new ReceiveIdempotencyService <string>(5 * 1000);

            receiveIdempotencyService.Add("Hello");

            receiveIdempotencyService.PausePacketExpiry();

            Thread.Sleep(10 * 1000);

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

            receiveIdempotencyService.Dispose();
        }