Ejemplo n.º 1
0
        public void ReceiveIdempotencyServiceFindShouldReturnFalseIfValueNotPresent1()
        {
            IReceiveIdempotencyService <string> receiveIdempotencyService = new ReceiveIdempotencyService <string>(1 * 60000);

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

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

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

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

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

            receiveIdempotencyService.Dispose();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 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();
        }