Пример #1
0
        public async Task Changing_Exposing_System_On_Interface_Clears_InterfaceField_In_All_Relations_To_Old_Exposing_System()
        {
            //Arrange
            var newExhibitor = await ItSystemHelper.CreateItSystemInOrganizationAsync(A <string>(), TestEnvironment.DefaultOrganizationId, AccessModifier.Public);

            var input = await PrepareFullRelationAsync(false, false, true);

            //Act
            using (var response = await SystemRelationHelper.SendPostRelationRequestAsync(input))
                using (var changeExposingSystem = await InterfaceExhibitHelper.SendCreateExhibitRequest(newExhibitor.Id, input.InterfaceId.GetValueOrDefault()))
                {
                    //Assert
                    Assert.Equal(HttpStatusCode.Created, response.StatusCode);
                    Assert.Equal(HttpStatusCode.Created, changeExposingSystem.StatusCode);
                    var relation = await response.ReadResponseBodyAsKitosApiResponseAsync <SystemRelationDTO>();

                    Assert.NotNull(relation.Interface);
                    using (var getAfterDeleteResponse = await SystemRelationHelper.SendGetRelationRequestAsync(input.FromUsageId, relation.Id))
                    {
                        Assert.Equal(HttpStatusCode.OK, getAfterDeleteResponse.StatusCode);
                        var relationAfterChange = await getAfterDeleteResponse.ReadResponseBodyAsKitosApiResponseAsync <SystemRelationDTO>();

                        Assert.Null(relationAfterChange.Interface);
                    }
                }
        }
Пример #2
0
        public async Task Changing_Exposing_System_To_Same_As_Existing_Does_Nothing()
        {
            //Arrange
            var input = await PrepareFullRelationAsync(false, false, true);

            var toUsage = await ItSystemHelper.GetItSystemUsage(input.ToUsageId);

            //Act
            using (var response = await SystemRelationHelper.SendPostRelationRequestAsync(input))
                using (var changeExposingSystem = await InterfaceExhibitHelper.SendCreateExhibitRequest(toUsage.ItSystemId, input.InterfaceId.GetValueOrDefault()))
                {
                    //Assert
                    Assert.Equal(HttpStatusCode.Created, response.StatusCode);
                    Assert.Equal(HttpStatusCode.Created, changeExposingSystem.StatusCode);
                    var relation = await response.ReadResponseBodyAsKitosApiResponseAsync <SystemRelationDTO>();

                    Assert.NotNull(relation.Interface);
                    using (var getAfterDeleteResponse = await SystemRelationHelper.SendGetRelationRequestAsync(input.FromUsageId, relation.Id))
                    {
                        Assert.Equal(HttpStatusCode.OK, getAfterDeleteResponse.StatusCode);
                        var relationAfterChange = await getAfterDeleteResponse.ReadResponseBodyAsKitosApiResponseAsync <SystemRelationDTO>();

                        Assert.NotNull(relationAfterChange.Interface); //interface should not have been cleared since the same exhibitor was provided as the existing --> no change
                    }
                }
        }
Пример #3
0
        public async Task Cannot_Set_Exposing_System(OrganizationRole role)
        {
            //Arrange
            var login = await HttpApi.GetCookieAsync(role);

            const int organizationId = TestEnvironment.DefaultOrganizationId;
            var       interfaceDto   = await InterfaceHelper.CreateInterface(InterfaceHelper.CreateInterfaceDto(A <string>(), A <string>(), organizationId, AccessModifier.Public));

            var system = await ItSystemHelper.CreateItSystemInOrganizationAsync(A <string>(), organizationId, AccessModifier.Public);

            //Act - perform the action with the actual role
            using (var result = await InterfaceExhibitHelper.SendCreateExhibitRequest(system.Id, interfaceDto.Id, login))
            {
                //Assert
                Assert.Equal(HttpStatusCode.Forbidden, result.StatusCode);
            }
        }