Exemple #1
0
        public async Task Can_Edit_SystemUsageWithRelations_Resets_Interface()
        {
            //Arrange
            var input = await PrepareFullRelationAsync(true, true, true);

            await SystemRelationHelper.SendPostRelationRequestAsync(input);

            var relations = await SystemRelationHelper.GetRelationsFromAsync(input.FromUsageId);

            var relationToEdit = relations.Single();
            var edited         = PrepareEditedRelation(relationToEdit, relationToEdit.ToUsage, relationToEdit.Contract, relationToEdit.FrequencyType, null);

            //Act
            using (var response = await SystemRelationHelper.SendPatchRelationRequestAsync(edited))
            {
                //Assert
                Assert.Equal(HttpStatusCode.OK, response.StatusCode);
                var relationDTO = await response.ReadResponseBodyAsKitosApiResponseAsync <SystemRelationDTO>();

                Assert.Equal(input.FromUsageId, relationDTO.FromUsage.Id);
                Assert.Equal(edited.ToUsage.Id, relationDTO.ToUsage.Id);
                Assert.Equal(edited.Description, relationDTO.Description);
                Assert.Equal(edited.Reference, relationDTO.Reference);
                Assert.NotNull(relationDTO.FrequencyType);
                Assert.NotNull(relationDTO.Contract);
                Assert.Null(relationDTO.Interface);
            }
        }