Subversion Repository Public Repository

ConnectionOdbcSdk

Diff Revisions 18 vs 19 for /trunk/ConnectionServerOdbcIntegrationTests/IntegrationTests/ConnectionInformixAdoNetDatabaseFunctionIntegrationTests.cs

Diff revisions: vs.
  @@ -1,11 +1,12 @@
1 1 using System;
2 2 using System.Data;
3 + using System.Threading;
3 4 using System.Threading.Tasks;
4 5 using IBM.Data.Informix;
5 6 using Microsoft.VisualStudio.TestTools.UnitTesting;
6 7 using Cisco.UnityConnection.OdbcSdk;
7 8
8 - namespace ConnectionServerOdbcIntegrationTests.IntegrationTests
9 + namespace UnityConnectionServerOdbcTests
9 10 {
10 11 [TestClass]
11 12 public class ConnectionInformixAdoNetDatabaseFunctionIntegrationTests : BaseIntegrationTests
  @@ -14,7 +15,7 @@
14 15
15 16 private bool _debugEventCalled;
16 17 private bool _errorEventCalled;
17 -
18 + private static bool _errorRaised;
18 19 #endregion
19 20
20 21
  @@ -25,6 +26,12 @@
25 26 public new static void MyClassInitialize(TestContext testContext)
26 27 {
27 28 BaseIntegrationTests.MyClassInitialize(testContext);
29 + Server.ErrorEvents += OnErrorEventsHandler;
30 + }
31 +
32 + private static void OnErrorEventsHandler(object sender, LogEventArgs logEventArgs)
33 + {
34 + _errorRaised = true;
28 35 }
29 36
30 37 #endregion
  @@ -35,7 +42,7 @@
35 42 [TestMethod]
36 43 public void ConstructorDesctructorTest()
37 44 {
38 - ConnectionInformixAdoNetDatabaseFunctions oTest = new ConnectionInformixAdoNetDatabaseFunctions("test");
45 + UnityConnectionDatabaseFunctionsInformixAdoNet oTest = new UnityConnectionDatabaseFunctionsInformixAdoNet("test");
39 46 oTest.Dispose();
40 47 }
41 48
  @@ -110,7 +117,7 @@
110 117 [TestMethod]
111 118 public void GetIfxConnectionStatusTest_Closed()
112 119 {
113 - ConnectionInformixAdoNetDatabaseFunctions oTemp = new ConnectionInformixAdoNetDatabaseFunctions("test");
120 + UnityConnectionDatabaseFunctionsInformixAdoNet oTemp = new UnityConnectionDatabaseFunctionsInformixAdoNet("test");
114 121 var iStatus = oTemp.DatabaseConnectionStatus;
115 122 Assert.IsTrue(iStatus != ConnectionState.Open, "Current connection status reporting open:" + iStatus);
116 123 }
  @@ -123,7 +130,7 @@
123 130 [TestMethod]
124 131 public void AttachToDatabase_InvalidServerName()
125 132 {
126 - CiscoUnityConnectionServerOdbc oServer = new CiscoUnityConnectionServerOdbc(new ConnectionInformixAdoNetDatabaseFunctions("Test"));
133 + UnityConnectionServerOdbc oServer = new UnityConnectionServerOdbc(new UnityConnectionDatabaseFunctionsInformixAdoNet("Test"));
127 134 var ret = oServer.LoginDatabaseBlocking("loginname", "password", "bogus server name");
128 135 Assert.IsFalse(ret.Successful,"Logging in with invalid server name should fail:"+ret);
129 136 }
  @@ -159,7 +166,7 @@
159 166 [TestMethod]
160 167 public void UpdateDatabaseName_NullConnection()
161 168 {
162 - CiscoUnityConnectionServerOdbc oTest = new CiscoUnityConnectionServerOdbc(new ConnectionInformixAdoNetDatabaseFunctions("test"));
169 + UnityConnectionServerOdbc oTest = new UnityConnectionServerOdbc(new UnityConnectionDatabaseFunctionsInformixAdoNet("test"));
163 170 var res = oTest.DatabaseFunctions.UpdateDatabaseName("UnityDirDb");
164 171 Assert.IsFalse(res.Successful,"Changing database name for a server not logged in did not fail:"+res);
165 172 }
  @@ -171,6 +178,46 @@
171 178 #region Data Fetch Method Tests
172 179
173 180 [TestMethod]
181 + public void AddParameters_Bool()
182 + {
183 + _errorRaised = false;
184 + const bool pBool = true;
185 + const string strSql = "SELECT COUNT(*) FROM vw_subscirber WHERE AutoAdvanceMsgs=?";
186 + Server.DatabaseFunctions.GetCount(strSql, pBool);
187 + Assert.IsFalse(_errorRaised, "Adding parrameter of type bool should not raise error");
188 + }
189 +
190 + [TestMethod]
191 + public void AddParameters_Int()
192 + {
193 + _errorRaised = false;
194 + const int pInt = 1;
195 + const string strSql = "SELECT COUNT(*) FROM vw_subscirber WHERE AutoAdvanceMsgs=?";
196 + Server.DatabaseFunctions.GetCount(strSql, pInt);
197 + Assert.IsFalse(_errorRaised, "Adding parrameter of type int should not raise error");
198 + }
199 +
200 + [TestMethod]
201 + public void AddParameters_Date()
202 + {
203 + _errorRaised = false;
204 + DateTime pDate = DateTime.Now;
205 + const string strSql = "SELECT COUNT(*) FROM vw_greeting WHERE timeexpires>?";
206 + Server.DatabaseFunctions.GetCount(strSql, pDate);
207 + Assert.IsFalse(_errorRaised, "Adding parrameter of type date should not raise error");
208 + }
209 +
210 + [TestMethod]
211 + public void AddParameters_IfxParameter()
212 + {
213 + _errorRaised = false;
214 + IfxParameter pParam = new IfxParameter("test",IfxType.BigInt);
215 + const string strSql = "SELECT COUNT(*) FROM vw_greeting WHERE AutoAdvanceMsgs>?";
216 + Server.DatabaseFunctions.GetCount(strSql, pParam);
217 + Assert.IsFalse(_errorRaised, "Adding parrameter of type IfxParameter should not raise error");
218 + }
219 +
220 + [TestMethod]
174 221 public void GetConfigurationString_EmptyStringFailure()
175 222 {
176 223 string res = Server.DatabaseFunctions.GetConfigurationString("");
  @@ -178,16 +225,31 @@
178 225 }
179 226
180 227 [TestMethod]
181 - public void GetRemoteFileName()
228 + public void GetRemoteFileName_Success()
182 229 {
183 230 string strName = Server.DatabaseFunctions.GetRemoteFileName();
184 231 Assert.IsTrue(!string.IsNullOrEmpty(strName),"Remote file name generation failed to return a valid name");
185 232
186 - bool ret = Server.DatabaseFunctions.IsStreamFileMarkedDeleted(strName);
187 - Assert.IsFalse(ret,"Newly created file should not be marked for deletion");
233 + bool bret = Server.DatabaseFunctions.IsStreamFileMarkedDeleted(strName);
234 + Assert.IsFalse(bret, "Newly created file should not be marked for deletion");
188 235
236 + const string strQuery = "Select ObjectID FROM vw_streamfile where filename=?";
237 + string strObjectId = Server.DatabaseFunctions.GetSingleValueFromQuery(strQuery, false, "", strName);
238 + Assert.IsFalse(string.IsNullOrEmpty(strObjectId), "Failed to get OBjectId of newly created stream file");
239 +
240 + Server.DatabaseFunctions.StartNewCommand("csp_streamfiledelete");
241 + Server.DatabaseFunctions.AddCommandParam("pObjectId", DbParamType.Char, strObjectId);
242 + var res = Server.DatabaseFunctions.ExecuteProc();
243 + Assert.IsTrue(res.Successful, "Failed to delete newly created stream file");
244 +
245 + Thread.Sleep(1000);
246 +
247 + bool ret = Server.DatabaseFunctions.IsStreamFileMarkedDeleted(strName);
248 + Assert.IsTrue(ret, "Deleted stream file not reported as deleted");
189 249 }
190 250
251 +
252 +
191 253 [TestMethod]
192 254 public void GetSingleValueFromQuery_NoDbConnection()
193 255 {
  @@ -206,13 +268,26 @@
206 268 Assert.IsTrue(string.IsNullOrEmpty(strRet), "Database connection lost should return empty string for single search result");
207 269 }
208 270
271 +
272 +
209 273 [TestMethod]
210 - public void GetMailstoresList()
274 + public void GetSingleValueFromQuery_EmptyReturnSet()
275 + {
276 + var res = Server.DatabaseFunctions.GetSingleValueFromQuery("select objectId from tbl_user where objectid='xxx'", true, "noData");
277 + Assert.IsTrue(res.Equals("noData"), "GetSingleValueFromQuery call should return no data string for empty return set");
278 + }
279 +
280 +
281 + [TestMethod]
282 + public void GetMailstoresList_Success()
211 283 {
212 284 var oList = Server.DatabaseFunctions.GetMailstoresList();
213 285 Assert.IsTrue(oList.Count>0,"No mailstores reported");
214 286 }
215 287
288 +
289 +
290 +
216 291 [TestMethod]
217 292 public void GetPrimaryDtmfAccessId_Success()
218 293 {
  @@ -223,8 +298,11 @@
223 298 Assert.IsFalse(string.IsNullOrEmpty(strPriExt),"Primary extension not found");
224 299 }
225 300
301 +
302 +
303 +
226 304 [TestMethod]
227 - public void GetAliasOfObject_Success()
305 + public void GetAliasOfObject_DisconnectedAutoReconnect_Success()
228 306 {
229 307 Server.DatabaseFunctions.Disconnect();
230 308 const string strQuery = "Select first 1 ObjectId from vw_Subscriber";
  @@ -233,6 +311,9 @@
233 311 Assert.IsFalse(string.IsNullOrEmpty(strAlias), "Alias not found");
234 312 }
235 313
314 +
315 +
316 +
236 317 [TestMethod]
237 318 public void GetCount_Disconnect_Success()
238 319 {
  @@ -247,19 +328,23 @@
247 328 {
248 329 const string strQuery = "SELECT COUNT(*) FROM Junk";
249 330 int icount = Server.DatabaseFunctions.GetCount(strQuery);
250 - Assert.IsTrue(icount == 0, "No count returned");
331 + Assert.IsTrue(icount == 0, "Invalid query to GetCount should return 0");
251 332 }
252 333
334 +
335 +
336 +
253 337 [TestMethod]
254 338 public void ExecuteNonQuery_InvalidQuery_Failure()
255 339 {
256 340 Server.DatabaseFunctions.Disconnect();
257 - Server.DatabaseFunctions.Disconnect();
258 341 const string strQuery = "SELECT COUNT(*) FORM vw_Subscriber WHERE junk=?";
259 342 int iRet = Server.DatabaseFunctions.ExecuteNonQuery(strQuery,"junk");
260 343 Assert.IsTrue(iRet == 0, "Invalid query should return 0");
261 344 }
262 345
346 +
347 +
263 348 [TestMethod]
264 349 public void FindUserByAliasOrExtension_EmptyParams()
265 350 {
  @@ -351,6 +436,7 @@
351 436 Assert.IsFalse(bRet, "Invalid alias and extension still returned true");
352 437 }
353 438
439 +
354 440
355 441 [TestMethod]
356 442 public void FindInterviewHandlerByNameOrExtension_EmptyParams()
  @@ -436,7 +522,7 @@
436 522
437 523
438 524 [TestMethod]
439 - public void FindDistributionLisByAliasNameOrExtension_EmptyParams()
525 + public void FindDistributionListByAliasNameOrExtension_EmptyParams()
440 526 {
441 527 int iCount;
442 528 string strObjectId, strDescription;
  @@ -445,7 +531,7 @@
445 531 }
446 532
447 533 [TestMethod]
448 - public void FindDistributionLisByAliasNameOrExtension_AllVoiceMailUsersAlias()
534 + public void FindDistributionListByAliasNameOrExtension_AllVoiceMailUsersAlias()
449 535 {
450 536 int iCount;
451 537 string strObjectId, strDescription;
  @@ -454,7 +540,7 @@
454 540 }
455 541
456 542 [TestMethod]
457 - public void FindDistributionLisByAliasNameOrExtension_AllVoiceMailUsersExtension()
543 + public void FindDistributionListByAliasNameOrExtension_AllVoiceMailUsersExtension()
458 544 {
459 545 int iCount;
460 546 string strObjectId, strDescription;
  @@ -463,7 +549,7 @@
463 549 }
464 550
465 551 [TestMethod]
466 - public void FindDistributionLisByAliasNameOrExtension_AllVoiceMailUsersDisplayName()
552 + public void FindDistributionListByAliasNameOrExtension_AllVoiceMailUsersDisplayName()
467 553 {
468 554 int iCount;
469 555 string strObjectId, strDescription;
  @@ -472,7 +558,7 @@
472 558 }
473 559
474 560 [TestMethod]
475 - public void FindDistributionLisByAliasNameOrExtension_NameAndExtension()
561 + public void FindDistributionListByAliasNameOrExtension_NameAndExtension()
476 562 {
477 563 int iCount;
478 564 string strObjectId, strDescription;
  @@ -481,14 +567,18 @@
481 567 }
482 568
483 569 [TestMethod]
484 - public void FindDistributionLisByAliasNameOrExtension_AliasNameAndExtension()
570 + public void FindDistributionListByAliasNameOrExtension_AliasNameAndExtension()
485 571 {
486 572 int iCount;
487 573 string strObjectId, strDescription;
488 - bool bRet = Server.DatabaseFunctions.FindDistributionListByAliasNameOrExtension("allvoicemailusers", "All Voice Mail Users", "99991", out iCount, out strObjectId, out strDescription,true);
574 + bool bRet = Server.DatabaseFunctions.FindDistributionListByAliasNameOrExtension("allvoicemailusers",
575 + "All Voice Mail Users", "99991", out iCount, out strObjectId, out strDescription, true);
489 576 Assert.IsTrue(bRet, "All Voice Mail Users not found by extension");
490 577 }
491 578
579 +
580 +
581 +
492 582 [TestMethod]
493 583 public void FindDistributionLisByAliasNameOrExtension_BothAliasAndExtension()
494 584 {
  @@ -537,6 +627,28 @@
537 627 Assert.IsFalse(res.Successful, "Query that returns no rows should return failure:" + res);
538 628 }
539 629
630 + [TestMethod]
631 + public void GetProcString_EmptyString()
632 + {
633 + string ret = Server.DatabaseFunctions.GetProcString();
634 + Assert.IsFalse(string.IsNullOrEmpty(ret), "Calling GetProcString with no command started should return blank string");
635 + }
636 +
637 +
638 + [TestMethod]
639 + public void IsStreamFileMarkedDeleted_EmptyString()
640 + {
641 + bool ret = Server.DatabaseFunctions.IsStreamFileMarkedDeleted("");
642 + Assert.IsFalse(ret, "Calling IsStreamFileMarkedDeleted with empty string should return false");
643 + }
644 +
645 + [TestMethod]
646 + public void IsStreamFileMarkedDeleted_InvalidId()
647 + {
648 + bool ret = Server.DatabaseFunctions.IsStreamFileMarkedDeleted("1234");
649 + Assert.IsFalse(ret, "Calling IsStreamFileMarkedDeleted with invalid ID should return false");
650 + }
651 +
540 652 #endregion
541 653
542 654
  @@ -938,7 +1050,7 @@
938 1050 }
939 1051
940 1052 [TestMethod]
941 - public void CallStoredProcNoRet_EmptyCommandString_Failure()
1053 + public void CallStoredProcNoRet_InvalidCommandString_Failure()
942 1054 {
943 1055 Server.DatabaseFunctions.StartNewCommand("x",false);
944 1056 var res = Server.DatabaseFunctions.ExecuteProc();
  @@ -957,13 +1069,27 @@
957 1069 MyClassInitialize(TestContext);
958 1070 }
959 1071
1072 +
960 1073
961 -
1074 + [TestMethod]
1075 + public void CallStoredProcNoRet_EmptyCommandString_Failure()
1076 + {
1077 + var res = Server.DatabaseFunctions.ExecuteProc();
1078 + Assert.IsFalse(res.Successful,"Calling stored proc with invalid Connection should fail:" + res);
1079 + }
962 1080
963 1081
964 1082 [TestMethod]
965 1083 public void CallStoredProc_EmptyCommandString_Failure()
966 1084 {
1085 + string strOut;
1086 + var res = Server.DatabaseFunctions.ExecuteProc(out strOut);
1087 + Assert.IsFalse(res.Successful, "Calling stored proc with empty command string should fail:" + res);
1088 + }
1089 +
1090 + [TestMethod]
1091 + public void CallStoredProc_InvalidCommandString_Failure()
1092 + {
967 1093 Server.DatabaseFunctions.StartNewCommand("x", false);
968 1094 string strOut;
969 1095 var res = Server.DatabaseFunctions.ExecuteProc(out strOut);
  @@ -983,6 +1109,8 @@
983 1109 MyClassInitialize(TestContext);
984 1110 }
985 1111
1112 +
1113 +
986 1114 #endregion
987 1115
988 1116
  @@ -1003,169 +1131,60 @@
1003 1131
1004 1132 }
1005 1133
1006 - [TestMethod]
1007 - public void GetActionDescription_InvalidAction()
1008 - {
1009 - string ret = Server.DatabaseFunctions.GetActionDescription("junk", 999, "objectId", "MenuObjectId");
1010 - Assert.IsTrue(ret.ToLower().Contains("(error) invalid action id"),"Action Id of 999 not reported as error");
1011 - }
1012 -
1013 -
1014 - [TestMethod]
1015 - public void GetActionDescription_IgnoreKey()
1016 - {
1017 - string ret = Server.DatabaseFunctions.GetActionDescription("junk", 0, "objectId", "MenuObjectId");
1018 - Assert.IsTrue(ret.ToLower().Contains("ignore key"), "Action Id of 0 not reported as ignore key");
1019 - }
1020 -
1021 - [TestMethod]
1022 - public void GetActionDescription_HangUp()
1023 - {
1024 - string ret = Server.DatabaseFunctions.GetActionDescription("junk", 1, "objectId", "MenuObjectId");
1025 - Assert.IsTrue(ret.ToLower().Contains("hang up"), "Action Id of 1 not reported as hangup");
1026 - }
1027 - [TestMethod]
1028 - public void GetActionDescription_GotoErrorGreeting()
1029 - {
1030 - string ret = Server.DatabaseFunctions.GetActionDescription("junk", 3, "objectId", "MenuObjectId");
1031 - Assert.IsTrue(ret.ToLower().Contains("goto error greeting"), "Action Id of 3 not reported as goto error greeting");
1032 - }
1033 - [TestMethod]
1034 - public void GetActionDescription_TakeMessage()
1035 - {
1036 - string ret = Server.DatabaseFunctions.GetActionDescription("junk", 4, "objectId", "MenuObjectId");
1037 - Assert.IsTrue(ret.ToLower().Contains("take message"), "Action Id of 4 not reported as Take Message");
1038 - }
1039 - [TestMethod]
1040 - public void GetActionDescription_SkipGreeting()
1041 - {
1042 - string ret = Server.DatabaseFunctions.GetActionDescription("junk", 5, "objectId", "MenuObjectId");
1043 - Assert.IsTrue(ret.ToLower().Contains("skip greeting"), "Action Id of 0 not reported as ignore key");
1044 - }
1045 - [TestMethod]
1046 - public void GetActionDescription_RepeatGreeting()
1047 - {
1048 - string ret = Server.DatabaseFunctions.GetActionDescription("junk", 6, "objectId", "MenuObjectId");
1049 - Assert.IsTrue(ret.ToLower().Contains("repeat greeting"), "Action Id of 6 not reported as repeat greeting");
1050 - }
1051 - [TestMethod]
1052 - public void GetActionDescription_RouteFromNext()
1053 - {
1054 - string ret = Server.DatabaseFunctions.GetActionDescription("junk", 8, "objectId", "MenuObjectId");
1055 - Assert.IsTrue(ret.ToLower().Contains("route from next call routing rule"), "Action Id of 8 not reported as route from next");
1056 - }
1057 -
1058 - [TestMethod]
1059 - public void GetActionDescription_AlternateTransferNumber()
1060 - {
1061 - string ret = Server.DatabaseFunctions.GetActionDescription("junk", 7, "objectId", "MenuObjectId");
1062 - Assert.IsTrue(ret.ToLower().Contains("transfer to alternate contact number"),
1063 - "Action Id of 7 not reported as alternate transfer number");
1064 - }
1065 -
1066 - [TestMethod]
1067 - public void GetActionDescription_Goto_EmptyConversationName()
1068 - {
1069 - string ret = Server.DatabaseFunctions.GetActionDescription("", 2, "objectId", "MenuObjectId");
1070 - Assert.IsTrue(ret.ToLower().Contains("(error)"),"Action Id of 2 with no conversation name not reported as error");
1071 - }
1072 -
1073 - [TestMethod]
1074 - public void GetActionDescription_Goto_InvalidConversationName()
1075 - {
1076 - string ret = Server.DatabaseFunctions.GetActionDescription("junk", 2, "objectId", "MenuObjectId");
1077 - Assert.IsTrue(ret.ToLower().Contains("(error)"), "Action Id of 2 with invalid conversation name not reported as error");
1078 - }
1079 -
1080 - [TestMethod]
1081 - public void GetActionDescription_Goto_SubSignIn()
1082 - {
1083 - string ret = Server.DatabaseFunctions.GetActionDescription("subsignin", 2, "objectId", "MenuObjectId");
1084 - Assert.IsTrue(ret.ToLower().Contains("user sign in"), "Correct goto conversation not recognized");
1085 - }
1086 -
1087 - [TestMethod]
1088 - public void GetActionDescription_Goto_GreetingsAdministrator()
1089 - {
1090 - string ret = Server.DatabaseFunctions.GetActionDescription("greetingsadministrator", 2, "objectId", "MenuObjectId");
1091 - Assert.IsTrue(ret.ToLower().Contains("greetings administrator"), "Correct goto conversation not recognized");
1092 - }
1093 -
1094 - [TestMethod]
1095 - public void GetActionDescription_Goto_ConvHotelCheckedOut()
1096 - {
1097 - string ret = Server.DatabaseFunctions.GetActionDescription("convhotelcheckedout", 2, "objectId", "MenuObjectId");
1098 - Assert.IsTrue(ret.ToLower().Contains("checked out hotel guest"), "Correct goto conversation not recognized");
1099 - }
1100 1134
1101 1135 [TestMethod]
1102 - public void GetActionDescription_Goto_ConvCvmMboxReset()
1136 + public void GetActionDescription_Goto_SystemCallHandler_Greeting()
1103 1137 {
1104 - string ret = Server.DatabaseFunctions.GetActionDescription("convcvmmboxreset", 2, "objectId", "MenuObjectId");
1105 - Assert.IsTrue(ret.ToLower().Contains("community voice mail box reset"), "Correct goto conversation not recognized");
1106 - }
1138 + const string strSql = "select FIRST 1 ObjectId from vw_callhandlernonprimary";
1139 + string strObjectId = Server.DatabaseFunctions.GetSingleValueFromQuery(strSql);
1140 + Assert.IsFalse(string.IsNullOrEmpty(strObjectId),"No objectId for first nonprimary call handler returned");
1107 1141
1108 - [TestMethod]
1109 - public void GetActionDescription_Goto_SubSystemTransfer()
1110 - {
1111 - string ret = Server.DatabaseFunctions.GetActionDescription("subsystransfer", 2, "objectId", "MenuObjectId");
1112 - Assert.IsTrue(ret.ToLower().Contains("user system transfer"), "Correct goto conversation not recognized");
1142 + string ret = Server.DatabaseFunctions.GetActionDescription("PhGreeting", 2, strObjectId, "MenuObjectId");
1143 + Assert.IsTrue(ret.ToLower().Contains("send to greeting for"), "Correct goto conversation not recognized");
1113 1144 }
1114 1145
1115 1146 [TestMethod]
1116 - public void GetActionDescription_Goto_SystemTransfer()
1147 + public void GetActionDescription_Goto_SystemCallHandler_RingPhone()
1117 1148 {
1118 - string ret = Server.DatabaseFunctions.GetActionDescription("systemtransfer", 2, "objectId", "MenuObjectId");
1119 - Assert.IsTrue(ret.ToLower().Contains("system transfer"), "Correct goto conversation not recognized");
1120 - }
1149 + const string strSql = "select FIRST 1 ObjectId from vw_callhandlernonprimary";
1150 + string strObjectId = Server.DatabaseFunctions.GetSingleValueFromQuery(strSql);
1151 + Assert.IsFalse(string.IsNullOrEmpty(strObjectId), "No objectId for first nonprimary call handler returned");
1121 1152
1122 - [TestMethod]
1123 - public void GetActionDescription_Goto_EasySignIn()
1124 - {
1125 - string ret = Server.DatabaseFunctions.GetActionDescription("easysignin", 2, "objectId", "MenuObjectId");
1126 - Assert.IsTrue(ret.ToLower().Contains("easy subscriber sign in"), "Correct goto conversation not recognized");
1153 + string ret = Server.DatabaseFunctions.GetActionDescription("PhTransfer", 2, strObjectId, "MenuObjectId");
1154 + Assert.IsTrue(ret.ToLower().Contains("ring phone for"), "Correct goto conversation not recognized");
1127 1155 }
1128 1156
1129 1157 [TestMethod]
1130 - public void GetActionDescription_Goto_TransferAlternateContactNumber()
1158 + public void GetActionDescription_Goto_PrimaryCallHandler_RingPhone()
1131 1159 {
1132 - string ret = Server.DatabaseFunctions.GetActionDescription("transferaltcontactnumber", 2, "objectId", "MenuObjectId");
1133 - Assert.IsTrue(ret.ToLower().Contains("alternate contact number"), "Correct goto conversation not recognized");
1134 - }
1160 + const string strSql = "select FIRST 1 ObjectId from vw_callhandlerprimary";
1161 + string strObjectId = Server.DatabaseFunctions.GetSingleValueFromQuery(strSql);
1162 + Assert.IsFalse(string.IsNullOrEmpty(strObjectId), "No objectId for first primary call handler returned");
1135 1163
1136 - [TestMethod]
1137 - public void GetActionDescription_Goto_BroadcastMessageAdministrator()
1138 - {
1139 - string ret = Server.DatabaseFunctions.GetActionDescription("broadcastmessageadministrator", 2, "objectId", "MenuObjectId");
1140 - Assert.IsTrue(ret.ToLower().Contains("broadcast message administrator"), "Correct goto conversation not recognized");
1164 + string ret = Server.DatabaseFunctions.GetActionDescription("PhTransfer", 2, strObjectId, "MenuObjectId");
1165 + Assert.IsTrue(ret.ToLower().Contains("ring phone for"), "Correct goto conversation not recognized");
1141 1166 }
1142 1167
1143 1168 [TestMethod]
1144 - public void GetActionDescription_Goto_Ad()
1169 + public void GetActionDescription_Goto_PrimaryCallHandler_Greeting()
1145 1170 {
1146 - string ret = Server.DatabaseFunctions.GetActionDescription("ad", 2, "objectId", "MenuObjectId");
1147 - Assert.IsTrue(ret.ToLower().Contains("invalid link"), "Correct goto conversation not recognized");
1148 - }
1171 + const string strSql = "select FIRST 1 ObjectId from vw_callhandlerprimary";
1172 + string strObjectId = Server.DatabaseFunctions.GetSingleValueFromQuery(strSql);
1173 + Assert.IsFalse(string.IsNullOrEmpty(strObjectId), "No objectId for first primary call handler returned");
1149 1174
1150 - [TestMethod]
1151 - public void GetActionDescription_Goto_PhTransfer()
1152 - {
1153 - string ret = Server.DatabaseFunctions.GetActionDescription("PhTransfer", 2, "objectId", "MenuObjectId");
1154 - Assert.IsTrue(ret.ToLower().Contains("invalid link"), "Correct goto conversation not recognized");
1175 + string ret = Server.DatabaseFunctions.GetActionDescription("PhGreeting", 2, strObjectId, "MenuObjectId");
1176 + Assert.IsTrue(ret.ToLower().Contains("send to greeting for"), "Correct goto conversation not recognized");
1155 1177 }
1156 1178
1157 1179 [TestMethod]
1158 - public void GetActionDescription_Goto_PhGreeting()
1180 + public void GetActionDescription_Goto_NameLookupHandler()
1159 1181 {
1160 - string ret = Server.DatabaseFunctions.GetActionDescription("PhGreeting", 2, "objectId", "MenuObjectId");
1161 - Assert.IsTrue(ret.ToLower().Contains("invalid link"), "Correct goto conversation not recognized");
1162 - }
1182 + const string strSql = "select FIRST 1 ObjectId from vw_directoryhandler";
1183 + string strObjectId = Server.DatabaseFunctions.GetSingleValueFromQuery(strSql);
1184 + Assert.IsFalse(string.IsNullOrEmpty(strObjectId), "No objectId for first name lookup handler returned");
1163 1185
1164 - [TestMethod]
1165 - public void GetActionDescription_Goto_PhInterview()
1166 - {
1167 - string ret = Server.DatabaseFunctions.GetActionDescription("PhInterview", 2, "objectId", "MenuObjectId");
1168 - Assert.IsTrue(ret.ToLower().Contains("invalid link"), "Correct goto conversation not recognized");
1186 + string ret = Server.DatabaseFunctions.GetActionDescription("ad", 2, strObjectId, "MenuObjectId");
1187 + Assert.IsTrue(ret.ToLower().Contains("route to name lookup handler"), "Correct goto conversation not recognized");
1169 1188 }
1170 1189
1171 1190 [TestMethod]
  @@ -1225,14 +1244,6 @@
1225 1244 Assert.IsTrue(ret, "Extension 555 not found in first partition");
1226 1245 }
1227 1246
1228 -
1229 - [TestMethod]
1230 - public void GetObjectDescription_Handler_Missing()
1231 - {
1232 - string ret = DbFunctions.GetObjectDescription("junk", ObjectsTypesWithExtensions.Handler);
1233 - Assert.IsTrue(ret.Contains("[Unknown Handler Type]"));
1234 - }
1235 -
1236 1247 [TestMethod]
1237 1248 public void GetObjectDescription_InterviewHandler()
1238 1249 {
  @@ -1279,12 +1290,6 @@
1279 1290 Assert.IsTrue(ret.Contains("[NO MATCH FOUND]"));
1280 1291 }
1281 1292
1282 - [TestMethod]
1283 - public void GetObjectDescription_Location_InvalidType()
1284 - {
1285 - string ret = DbFunctions.GetObjectDescription("Junk", (ObjectsTypesWithExtensions)99);
1286 - Assert.IsTrue(ret.Contains("(error)"));
1287 - }
1288 1293 #endregion
1289 1294
1290 1295
  @@ -1318,7 +1323,7 @@
1318 1323 [TestMethod]
1319 1324 public void CycleDatabaseConnection_Failure()
1320 1325 {
1321 - ConnectionInformixAdoNetDatabaseFunctions oTest = new ConnectionInformixAdoNetDatabaseFunctions("test");
1326 + UnityConnectionDatabaseFunctionsInformixAdoNet oTest = new UnityConnectionDatabaseFunctionsInformixAdoNet("test");
1322 1327 Assert.IsFalse(oTest.CycleDatabaseConnection(), "Cycling database without logging in first did not fail");
1323 1328 }
1324 1329