/// <summary> /// News the application_ add new relationship implementation. /// </summary> /// <param name="cardinality">The cardinality.</param> /// <param name="cascadeDelete">if set to <c>true</c> [cascade delete].</param> /// <param name="cascadeDeleteTo">if set to <c>true</c> [cascade delete to].</param> /// <param name="implicitInSolution">if set to <c>true</c> [implicit in solution].</param> /// <param name="reverseImplicitInSolution">if set to <c>true</c> [reverse implicit in solution].</param> public void NewApplication_AddNewRelationshipImpl(CardinalityEnum_Enumeration cardinality, bool cascadeDelete, bool cascadeDeleteTo, bool implicitInSolution, bool reverseImplicitInSolution) { var application = TestMigrationHelper.CreateAppLibraryApplication( ); application.SetCardinality(cardinality); DataTable appDataBit = application.Data.Tables[TableNames.AppDataBit]; AppDetails.CreateAppDataRow(appDataBit, application.AppVerUid, application.RelationshipUid, AppDetails.CascadeDeleteUid, cascadeDelete); AppDetails.CreateAppDataRow(appDataBit, application.AppVerUid, application.RelationshipUid, AppDetails.CascadeDeleteToUid, cascadeDeleteTo); AppDetails.CreateAppDataRow(appDataBit, application.AppVerUid, application.RelationshipUid, AppDetails.ImplicitInSolutionUid, implicitInSolution); AppDetails.CreateAppDataRow(appDataBit, application.AppVerUid, application.RelationshipUid, AppDetails.ReverseImplicitInSolutionUid, reverseImplicitInSolution); TestMigrationHelper.SaveAppLibraryApplication(application); AppManager.DeployApp(RunAsDefaultTenant.DefaultTenantName, application.SolutionUid.ToString("B")); long tenantId = RequestContext.TenantId; DatabaseContext context = DatabaseContext.GetContext( ); Assert.IsTrue(TenantMergeProcessorTestHelper.ConfirmTenantEntity(context, tenantId, application.FromTypeUid), "Type A was not deployed as part of an existing application."); Assert.IsTrue(TenantMergeProcessorTestHelper.ConfirmTenantEntity(context, tenantId, application.ToTypeUid), "Type B was not deployed as part of an existing application."); Assert.IsTrue(TenantMergeProcessorTestHelper.ConfirmTenantEntity(context, tenantId, application.RelationshipUid), "Relationship was not deployed as part of an existing application."); Assert.IsTrue(TenantMergeProcessorTestHelper.ConfirmTenantRelationship(context, tenantId, Direction.Forward, AppDetails.CardinalityUid, application.RelationshipUid, AppDetails.ConvertCardinalityEnumToUpgradeId(cardinality)), "Relationship cardinality was not deployed."); Assert.IsTrue(TenantMergeProcessorTestHelper.ConfirmTenantFieldValue(context, tenantId, DataTableType.Bit, application.RelationshipUid, AppDetails.CascadeDeleteUid, cascadeDelete), "Relationship cascadeDelete value was not deployed."); Assert.IsTrue(TenantMergeProcessorTestHelper.ConfirmTenantFieldValue(context, tenantId, DataTableType.Bit, application.RelationshipUid, AppDetails.CascadeDeleteToUid, cascadeDeleteTo), "Relationship cascadeDelete to value was not deployed."); Assert.IsTrue(TenantMergeProcessorTestHelper.ConfirmTenantFieldValue(context, tenantId, DataTableType.Bit, application.RelationshipUid, AppDetails.ImplicitInSolutionUid, implicitInSolution), "Relationship implicitInSolution value was not deployed."); Assert.IsTrue(TenantMergeProcessorTestHelper.ConfirmTenantFieldValue(context, tenantId, DataTableType.Bit, application.RelationshipUid, AppDetails.ReverseImplicitInSolutionUid, reverseImplicitInSolution), "Relationship reverseImplicitInSolution value was not deployed."); }
public void Bug24784( ) { Guid newInstanceId = Guid.NewGuid( ); var application = TestMigrationHelper.CreateAppLibraryApplication( ); application.CreateAppEntityRow(application.AppVerUid, newInstanceId); application.CreateAppDataRow(TableNames.AppDataNVarChar, application.AppVerUid, newInstanceId, AppDetails.NameUid, "Violation Test"); application.SetCardinality(CardinalityEnum_Enumeration.OneToOne); application.CreateAppRelationshipRow(application.AppVerUid, AppDetails.IsOfTypeUid, newInstanceId, application.FromTypeUid); application.CreateAppRelationshipRow(application.AppVerUid, AppDetails.InSolutionUid, newInstanceId, application.SolutionUid); application.CreateAppRelationshipRow(application.AppVerUid, AppDetails.SecurityOwnerUid, newInstanceId, AppDetails.AdministratorUserAccountUid); application.CreateAppRelationshipRow(application.AppVerUid, application.RelationshipUid, newInstanceId, application.ToInstanceUid); TestMigrationHelper.SaveAppLibraryApplication(application); AppManager.DeployApp(RunAsDefaultTenant.DefaultTenantName, application.SolutionUid.ToString("B")); StatisticsReport statisticsReport = AppManager.StageApp(RunAsDefaultTenant.DefaultTenantName, application.SolutionUid.ToString("B")); Assert.IsNull(statisticsReport.CardinalityViolations, "Cardinality violations not null in report"); }