Exemplo n.º 1
0
        public async Task Distributor_Trace_default_behavior_can_be_overridden()
        {
            Lease <int> leaseAcquired = null;
            Lease <int> leaseReleased = null;

            var distributor1 = new InMemoryDistributor <int>(new[]
            {
                new Leasable <int>(1, "1")
            }, "").Trace(
                onLeaseAcquired: l => { leaseAcquired = l; },
                onLeaseReleasing: l => { leaseReleased = l; });

            distributor1.OnReceive((async _ => { }));
            var distributor = distributor1;

            await distributor.Distribute(1);

            leaseAcquired.Should().NotBeNull();
            leaseReleased.Should().NotBeNull();
        }