public void TestDeleteVenue() { DataSet ResponseDS = new PartnerEditTDS(); TVerificationResultCollection VerificationResult; String TextMessage; Boolean CanDeletePartner; PPartnerRow VenuePartnerRow; TSubmitChangesResult result; Int64 PartnerKey; TPartnerEditUIConnector connector = new TPartnerEditUIConnector(); PartnerEditTDS MainDS = new PartnerEditTDS(); VenuePartnerRow = TCreateTestPartnerData.CreateNewVenuePartner(MainDS); result = connector.SubmitChanges(ref MainDS, ref ResponseDS, out VerificationResult); Assert.AreEqual(TSubmitChangesResult.scrOK, result, "create venue record"); // check if Venue partner can be deleted (still needs to be possible at this point) CanDeletePartner = TPartnerWebConnector.CanPartnerBeDeleted(VenuePartnerRow.PartnerKey, out TextMessage); if (TextMessage.Length > 0) { TLogging.Log(TextMessage); } Assert.IsTrue(CanDeletePartner); // set up buildings for this venue so deletion is not allowed PcBuildingTable BuildingTable = new PcBuildingTable(); PcBuildingRow BuildingRow = BuildingTable.NewRowTyped(); BuildingRow.VenueKey = VenuePartnerRow.PartnerKey; BuildingRow.BuildingCode = "Test"; BuildingTable.Rows.Add(BuildingRow); PcBuildingAccess.SubmitChanges(BuildingTable, DBAccess.GDBAccessObj.Transaction); // now deletion must not be possible since a building is linked to the venue CanDeletePartner = TPartnerWebConnector.CanPartnerBeDeleted(VenuePartnerRow.PartnerKey, out TextMessage); if (TextMessage.Length > 0) { TLogging.Log(TextMessage); } Assert.IsTrue(!CanDeletePartner); // now test actual deletion of venue partner VenuePartnerRow = TCreateTestPartnerData.CreateNewVenuePartner(MainDS); PartnerKey = VenuePartnerRow.PartnerKey; result = connector.SubmitChanges(ref MainDS, ref ResponseDS, out VerificationResult); Assert.AreEqual(TSubmitChangesResult.scrOK, result, "create venue record for deletion"); // check if Venue record is being deleted Assert.IsTrue(TPartnerWebConnector.DeletePartner(PartnerKey, out VerificationResult)); // check that Venue record is really deleted Assert.IsTrue(!TPartnerServerLookups.VerifyPartner(PartnerKey)); }
public void TestDeleteVenue() { DataSet ResponseDS = new PartnerEditTDS(); TVerificationResultCollection VerificationResult; String TextMessage; Boolean CanDeletePartner; PPartnerRow VenuePartnerRow; TSubmitChangesResult result; Int64 PartnerKey; TPartnerEditUIConnector connector = new TPartnerEditUIConnector(); PartnerEditTDS MainDS = new PartnerEditTDS(); VenuePartnerRow = TCreateTestPartnerData.CreateNewVenuePartner(MainDS); result = connector.SubmitChanges(ref MainDS, ref ResponseDS, out VerificationResult); Assert.AreEqual(TSubmitChangesResult.scrOK, result, "create venue record"); // check if Venue partner can be deleted (still needs to be possible at this point) CanDeletePartner = TPartnerWebConnector.CanPartnerBeDeleted(VenuePartnerRow.PartnerKey, out TextMessage); if (TextMessage.Length > 0) { TLogging.Log(TextMessage); } Assert.IsTrue(CanDeletePartner); // set up buildings for this venue so deletion is not allowed PcBuildingTable BuildingTable = new PcBuildingTable(); PcBuildingRow BuildingRow = BuildingTable.NewRowTyped(); BuildingRow.VenueKey = VenuePartnerRow.PartnerKey; BuildingRow.BuildingCode = "Test"; BuildingTable.Rows.Add(BuildingRow); PcBuildingAccess.SubmitChanges(BuildingTable, DBAccess.GDBAccessObj.Transaction); // now deletion must not be possible since a building is linked to the venue CanDeletePartner = TPartnerWebConnector.CanPartnerBeDeleted(VenuePartnerRow.PartnerKey, out TextMessage); if (TextMessage.Length > 0) { TLogging.Log(TextMessage); } Assert.IsTrue(!CanDeletePartner); // now test actual deletion of venue partner VenuePartnerRow = TCreateTestPartnerData.CreateNewVenuePartner(MainDS); PartnerKey = VenuePartnerRow.PartnerKey; result = connector.SubmitChanges(ref MainDS, ref ResponseDS, out VerificationResult); Assert.AreEqual(TSubmitChangesResult.scrOK, result, "create venue record for deletion"); // check if Venue record is being deleted Assert.IsTrue(TPartnerWebConnector.DeletePartner(PartnerKey, out VerificationResult)); // check that Venue record is really deleted Assert.IsTrue(!TPartnerServerLookups.VerifyPartner(PartnerKey)); }