public virtual async Task A_lease_can_be_extended()
        {
            var tally        = new ConcurrentDictionary <string, int>();
            var pool         = DateTimeOffset.UtcNow.Ticks.ToString();
            var distributor1 = CreateDistributor(pool: pool).Trace();
            var distributor2 = CreateDistributor(pool: pool).Trace();

            Func <Lease <int>, Task> onReceive = async lease =>
            {
                tally.AddOrUpdate(lease.Leasable.Name,
                                  addValueFactory: s => 1,
                                  updateValueFactory: (s, v) => v + 1);

                if (lease.Leasable.Name == "5")
                {
                    // extend the lease
                    await lease.Extend(TimeSpan.FromDays(2));

                    // wait longer than the lease would normally last
                    await Task.Delay((int)(DefaultLeaseDuration.TotalMilliseconds * 5));
                }
            };

            distributor1.OnReceive(onReceive);
            distributor2.OnReceive(onReceive);
            await distributor1.Start();

            await distributor2.Start();

            await Task.Delay((int)(DefaultLeaseDuration.TotalMilliseconds * 2.5));

            await distributor1.Stop();

            await distributor2.Stop();

            Console.WriteLine(tally.ToLogString());

            tally.Should().ContainKey("5")
            .And
            .Subject["5"].Should().Be(1);
        }
        public virtual async Task A_lease_can_be_extended()
        {
            var tally = new ConcurrentDictionary<string, int>();
            var scope = DateTimeOffset.UtcNow.Ticks.ToString();
            var distributor1 = CreateDistributor(scope: scope).Trace();
            var distributor2 = CreateDistributor(scope: scope).Trace();

            Func<Lease, Task> onReceive = async lease =>
            {
                tally.AddOrUpdate(lease.LeasableResource.Name,
                                  addValueFactory: s => 1,
                                  updateValueFactory: (s, v) => v + 1);

                if (lease.LeasableResource.Name == "5")
                {
                    // extend the lease
                    await lease.Extend(TimeSpan.FromDays(2));

                    // wait longer than the lease would normally last
                    await Task.Delay((int) (DefaultLeaseDuration.TotalMilliseconds*5));
                }
            };

            distributor1.OnReceive(onReceive);
            distributor2.OnReceive(onReceive);
            await distributor1.Start();
            await distributor2.Start();
            await Task.Delay((int) (DefaultLeaseDuration.TotalMilliseconds * 2.5));
            await distributor1.Stop();
            await distributor2.Stop();

            Console.WriteLine(tally.ToLogString());

            tally.Should().ContainKey("5")
                 .And
                 .Subject["5"].Should().Be(1);
        }