private void SetAatfDeleteFlags(DeleteAnAatf message) { var canAatfBeDeletedFlags = new CanAatfBeDeletedFlags(); canAatfBeDeletedFlags |= CanAatfBeDeletedFlags.CanDelete; A.CallTo(() => getAatfDeletionStatus.Validate(message.AatfId)).Returns(canAatfBeDeletedFlags); }
public async Task HandleAsync_GivenAatfCanBeDeleted_AatfShouldBeRemovedButOrganisationNotRemoved() { using (var databaseWrapper = new DatabaseWrapper()) { var organisation = EA.Weee.Domain.Organisation.Organisation.CreatePartnership("trading"); var aatf = ObligatedWeeeIntegrationCommon.CreateAatf(databaseWrapper, organisation); databaseWrapper.WeeeContext.Aatfs.Add(aatf); await databaseWrapper.WeeeContext.SaveChangesAsync(); databaseWrapper.WeeeContext.Aatfs.Where(a => a.Id == aatf.Id).Should().NotBeEmpty(); var message = new DeleteAnAatf(aatf.Id, aatf.Organisation.Id); SetAatfDeleteFlags(message); await Handler(databaseWrapper).HandleAsync(message); databaseWrapper.WeeeContext.Aatfs.Where(a => a.Id == aatf.Id).Should().BeEmpty(); databaseWrapper.WeeeContext.Organisations.Where(a => a.Id == organisation.Id).Should().NotBeEmpty(); } }