예제 #1
0
        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);
                    }
        }
예제 #2
0
        public async Task Deleting_ToSystemUsage_Removes_Relation()
        {
            //Arrange
            var input = await PrepareFullRelationAsync(false, false, false);

            //Act
            using (var response = await SystemRelationHelper.SendPostRelationRequestAsync(input))
            {
                Assert.Equal(HttpStatusCode.Created, response.StatusCode);
                var relation = await response.ReadResponseBodyAsKitosApiResponseAsync <SystemRelationDTO>();

                using (var deleteUsageResponse = await ItSystemHelper.SendRemoveUsageAsync(input.ToUsageId, TestEnvironment.DefaultOrganizationId))
                {
                    //Assert
                    Assert.Equal(HttpStatusCode.OK, deleteUsageResponse.StatusCode);
                    var relations = (await SystemRelationHelper.GetRelationsFromAsync(input.FromUsageId)).ToList();
                    Assert.Empty(relations.Where(x => x.Id == relation.Id));
                }
            }
        }