Exemplo n.º 1
0
        public void when_try_release_where_envelope_null()
        {
            var memoryQuarantine  = new MemoryQuarantine();
            var immutableEnvelope = new ImmutableEnvelope("EnvId", DateTime.UtcNow, new SerializerTest1 {
                Name = "Test1"
            },
                                                          new[]
            {
                new MessageAttribute("key1", "val1"),
                new MessageAttribute("key2", "val2"),
            });
            var result0 = memoryQuarantine.TryToQuarantine(immutableEnvelope, new Exception());

            memoryQuarantine.TryRelease(null);
            var result1 = memoryQuarantine.TryToQuarantine(immutableEnvelope, new Exception());
            var result2 = memoryQuarantine.TryToQuarantine(immutableEnvelope, new Exception());
            var result3 = memoryQuarantine.TryToQuarantine(immutableEnvelope, new Exception());
            var result4 = memoryQuarantine.TryToQuarantine(immutableEnvelope, new Exception());

            Assert.IsFalse(result0);
            Assert.IsFalse(result1);
            Assert.IsFalse(result2);
            Assert.IsTrue(result3);
            Assert.IsFalse(result4);
        }
Exemplo n.º 2
0
 public void TryRelease(ImmutableEnvelope context)
 {
     _quarantine.TryRelease(context);
 }