public void use_the_lease_manager_that_is_provided()
        {
            var fakeManager = A.Fake <ILeaseManager>();
            var builder     = new LeaseConfigurationBuilder(NodeId);

            builder.WithLeaseManager(configuration => fakeManager);
            var config = builder.Build();

            Assert.Same(fakeManager, config.LeaseManager(config));
        }
示例#2
0
 public static void WithAzureBlobStorageLeaseManager(this LeaseConfigurationBuilder builder, BlobSettings settings)
 {
     builder.WithLeaseManager(lc =>
     {
         var validator   = new AzureBlobLeaseLengthValidator();
         var leaseLength = lc.LeaseLengthCalculator.Calculate();
         validator.Validate(leaseLength);
         return(new AzureBlobLeaseManager(settings, leaseLength));
     });
 }
 public static LeaseConfigurationBuilder WithInMemoryLeaseManager(this LeaseConfigurationBuilder builder)
 {
     return(builder.WithLeaseManager(lc => new InMemoryLeaseManager(lc.NodeId)));
 }