public void DeleteContact_ContactExistsAndNotLocked_DeletesContact( IElasticAnalyticsContactService contactService, ElasticContact eContact, ISystemContext ctx) { contactService.Delete(eContact.Id, ctx); }
public void DeleteContact_ContactDoesntExist_ReturnsSuccessfully( IElasticAnalyticsContactService contactService, ILeaseService leaseService, ElasticContact contact, ElasticLeaseOwner us, ElasticLeaseOwner them, ISystemContext ctx, TestIndexUtils contactIndex) { using (contactIndex) { AssertionExtensions.ShouldNotThrow(() => contactService.Delete(contact.Id, ctx)); } }
public void DeleteContact_ContactExistsWithActiveLeaseByDifferentOwner_DeleteStillHonoured( IElasticAnalyticsContactService contactService, ILeaseService leaseService, ElasticContact contact, ElasticLeaseOwner us, ElasticLeaseOwner them, ISystemContext ctx, TestIndexUtils contactIndex) { using (contactIndex) { contactService.Save(contact, them, false, ctx).Should().BeTrue(); // deletes seem to be brutal contactService.Delete(contact.Id, ctx); contactService .LoadForReadOnly(contact.Id, ctx) .Should() .BeNull(); // lease is deleted so if we wanted, we can just go and create another contact with the // same id straight away... contact.Lease = null; contactService.Save(contact, us, false, ctx).Should().BeTrue(); } }
public void DeleteContact_ContactExistsWithActiveLeaseBySameOwner_ContactDeleted( IElasticAnalyticsContactService contactService, ElasticContact contact, ElasticLeaseOwner us, ISystemContext ctx, TestIndexUtils contactIndex) { using (contactIndex) { contactService.Save(contact, us, false, ctx).Should().BeTrue(); // deletes seem to be brutal - they don't care about locks contactService.Delete(contact.Id, ctx); contactService .LoadForReadOnly(contact.Id, ctx) .Should() .BeNull(); } }
public void DeleteContact_ContactExistsWithExpiredLeaseByDifferentOwner_ContactDeleted( IElasticAnalyticsContactService contactService, ElasticContact contact, ElasticLeaseOwner them, ISystemContext ctx, IDateTimeController dateTime, TestIndexUtils contactIndex) { using (contactIndex) { // arrange contact with expired lease from another owner... var timeTraveller = (DateTimeTimeTraveller)dateTime; using (timeTraveller.NewJourney(-24)) { contactService.Save(contact, them, false, ctx).Should().BeTrue(); } // deletes don't have an owner, at this level at least. contactService.Delete(contact.Id, ctx); contactService .LoadForReadOnly(contact.Id, ctx) .Should() .BeNull(); } }
public void DeleteContact_ContactExistsWithNoLease_ContactDeleted( IElasticAnalyticsContactService contactService, ElasticContact contact, ElasticLeaseOwner us, ISystemContext ctx, TestIndexUtils contactIndex) { using (contactIndex) { contactService .Save(contact, us, true, ctx) .Should().BeTrue(); contactService.Delete(contact.Id, ctx); contactService .LoadForReadOnly(contact.Id, ctx) .Should() .BeNull(); } }