public void TryExtendLock_ContactExistsLockedByDifferentOwner_NotExtended( IElasticAnalyticsContactService contactService, ElasticContact contact, ElasticLeaseOwner them, ElasticLeaseOwner us, ISystemContext ctx, TestIndexUtils contactIndex) { using (contactIndex) { // lock by a different owner contactService.Save(contact, them, false, ctx) .Should().Be(true); // extend it contact.Lease = new ElasticLease(contact.Id, DateTime.UtcNow, us); // specify the lease we want var res = contactService.TryExtendLock(contact, TimeSpan.FromHours(1), ctx); res.Should().BeFalse(); contact.Lease.IsOwnedBy(us); // currently Andes does not update the lease reference in this scenario } }
public void TryExtendLock_ContactExistsLockedBySameOwner_LeaseExtended( IElasticAnalyticsContactService contactService, ElasticContact contact, ElasticLeaseOwner us, ISystemContext ctx, TestIndexUtils contactIndex) { using (contactIndex) { contactService.Save(contact, us, false, ctx) .Should().Be(true); var res = contactService.TryExtendLock(contact, TimeSpan.FromHours(1), ctx); res.Should().BeTrue(); contact.Lease.IsOwnedBy(us); } }