private static async Task AssertRelationExists(SystemRelationDTO expectedRelation, ItSystemUsageDTO usage, bool hasInterface = false, bool hasFrequency = false, bool hasContract = false) { var response = await SystemRelationHelper.SendGetRelationRequestAsync(usage.Id, expectedRelation.Id); var relation = await response.ReadResponseBodyAsKitosApiResponseAsync <SystemRelationDTO>(); Assert.Equal(expectedRelation.Id, relation.Id); Assert.Equal(expectedRelation.Description, relation.Description); if (hasInterface) { AssertEqualNamedEntities(expectedRelation.Interface, relation.Interface); } else { Assert.Null(relation.Interface); } if (hasFrequency) { AssertEqualNamedEntities(expectedRelation.FrequencyType, relation.FrequencyType); } else { Assert.Null(relation.FrequencyType); } if (hasContract) { AssertEqualNamedEntities(expectedRelation.Contract, relation.Contract); } else { Assert.Null(relation.Contract); } }
public async Task Can_Delete_SystemUsageWithRelations() { //Arrange var input = await PrepareFullRelationAsync(false, false, false); using (await SystemRelationHelper.SendPostRelationRequestAsync(input)) using (var deletionResponse = await ItSystemHelper.SendRemoveUsageAsync(input.FromUsageId, OrganizationId)) using (var getAfterDeleteResponse = await SystemRelationHelper.SendGetRelationRequestAsync(input.FromUsageId, OrganizationId)) { Assert.Equal(HttpStatusCode.OK, deletionResponse.StatusCode); Assert.Equal(HttpStatusCode.NotFound, getAfterDeleteResponse.StatusCode); } }