Esempio n. 1
0
        private async Task Deleted_CustomField_Disappears_From_BacklogItems_Using_This_Field()
        {
            // GIVEN 2 tickets referencing 2 custom fields
            var customFieldId1 = await CreateSampleCustomField();

            var customFieldId2 = await CreateSampleCustomField();

            var(ticketId1, _) = await CreateSampleBug(customFieldId1, customFieldId2);

            var(ticketId2, _) = await CreateSampleBug(customFieldId1, customFieldId2);

            // WHEN deleting 1 custom field
            await _commandService.Delete(customFieldId1);

            await SaveChanges();

            // THEN
            // The custom fields used in the 2 tickets also get deleted
            var ticket1 = (await _queryTicketService.GetById(ticketId1 !)).Value;

            Assert.Equal(1, ticket1.CustomFields !.Count);
            Assert.Equal(customFieldId2, ticket1.CustomFields[0].CustomFieldId);
            var ticket2 = (await _queryTicketService.GetById(ticketId2 !)).Value;

            Assert.Equal(1, ticket2.CustomFields !.Count);
            Assert.Equal(customFieldId2, ticket2.CustomFields[0].CustomFieldId);
        }
Esempio n. 2
0
        private async Task Deleted_CustomField_Disappears_From_Db()
        {
            // GIVEN a custom field
            var customFieldRef = await CreateSampleCustomField();

            // WHEN deleting
            var response = await _commandService.Delete(customFieldRef.Id);

            await SaveChanges();

            // THEN
            // Deletion was successful
            Assert.True(response.IsSuccess);
            // The returned ID of the deleted entity is correct
            Assert.Equal(customFieldRef.Id, response.Value.Id);

            // the entity disappears from the DB
            var record = await _queryService.GetById(customFieldRef.Id);

            Assert.False(record.IsSuccess);
        }
 public Task <ActionResult <CustomFieldReferenceDto> > Delete([FromServices] ICustomFieldCommandService service,
                                                              [FromRoute] string id)
 => service.Delete(id).ToActionResultOfT();